VBA Excel help
I am new to Excel Macro and i was given the task with the following excel data
Date Brazil Turkey Italy Panama Lithuania
3/15/2014 110 47 192 0 2
3/16/2014 118 54 179 0 7
3/17/2014 72 22 96 0 1
3/18/2014 17 20 60 2 2
3/19/2014 19 17 57 0 1
3/20/2014 15 21 52 0 2
I am to create a Macro so the ending result for each Date like such.I have looked up various of ways to do it, but cant seem to find a way. Thank you very much
Date Country Downloads
3/15/2014 Brazil 110
3/15/2014 Turkey 47
3/15/2014 Italy 192
3/15/2014 Czech Republic 19
3/15/2014 Panama 0
3/15/2014 Lithuania 2
3/15/2014 Costa Rica 6
3/15/2014 Luxembourg 1
Pull Text And Paste As required
Try this:
[code]
Private Sub cmdPullTextAndPaste_Click()
'http://excelexperts.com/vba-excel-help
Dim LastRecNum As Long
Sheets("Sheet2").Select
Worksheets("Sheet2").Cells.ClearContents
Range("A1").Select 'of Sheet2
Selection.Value = "Date"
Selection.Offset(0, 1).Value = "Country"
Selection.Offset(0, 2).Value = "Downloads"
Sheets("Sheet1").Select
Range("A1").Select 'of Sheet1
'Finding Last Record Number of Sheet1
LastRecNum = Cells(Rows.Count, "A").End(xlUp).Row 'to go to last data cell inspite of blank cells
Range("A2").Select 'of Sheet1
Dim Dt As Date
Dim Cy As String
Dim Dnld As Long
Dim NowSheet2Row As Long
Dim NowClmn As Integer
NowSheet2Row = 1
Do While ActiveCell.Row <= LastRecNum
Dt = Selection.Value 'Date copied
For NowClmn = 1 To 5
NowSheet2Row = NowSheet2Row + 1
Cy = Cells(1, NowClmn + 1).Value 'Country copied
Dnld = Selection.Offset(0, NowClmn).Value 'Downloads copied
Sheets("Sheet2").Cells(NowSheet2Row, 1).Value = Dt
Sheets("Sheet2").Cells(NowSheet2Row, 2).Value = Cy
Sheets("Sheet2").Cells(NowSheet2Row, 3).Value = Dnld
Next
Selection.Offset(1, 0).Select
Loop
End Sub
[/code]