Hi All,
I just wanted to know how to do this and what's wrong in this script:
I need to copy data from a range (Row) on a sheet and paste it into another sheet as column based on a date that matches the header of the column:
'In this example I am Copying the Data from Sheet"x" (Source) to Sheet"y" (Destination)based on a condition on a specific cell
Sub sbCopyRangeToAnotherSheet()
Dim TotalRows As Long
Dim i As Long
Sheets("Export Gas").Select
TotalRows = ActiveSheet.UsedRange.Columns.Count
For i = 1 To TotalRows
If Cells(1, i).Value = Sheets("Daily Export Gas").Cells(2, 7).Value Then
Sheets("Daily Export Gas").Range("D8:J8").Copy
Sheets("Export Gas").Range("i2:i8").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Else
End If
Next
End Sub
Help Please
I just wanted to know how to do this and what's wrong in this script:
I need to copy data from a range (Row) on a sheet and paste it into another sheet as column based on a date that matches the header of the column:
'In this example I am Copying the Data from Sheet"x" (Source) to Sheet"y" (Destination)based on a condition on a specific cell
Sub sbCopyRangeToAnotherSheet()
Dim TotalRows As Long
Dim i As Long
Sheets("Export Gas").Select
TotalRows = ActiveSheet.UsedRange.Columns.Count
For i = 1 To TotalRows
If Cells(1, i).Value = Sheets("Daily Export Gas").Cells(2, 7).Value Then
Sheets("Daily Export Gas").Range("D8:J8").Copy
Sheets("Export Gas").Range("i2:i8").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
Else
End If
Next
End Sub
Help Please
