I want to copy a range of cells and paste them in the same sheet beside that range. I am using below code to find that range
Set x6 = CreateObject("Excel.application")
Set XlBook = x6.Workbooks.Open("C:\eCMSAutomatedReports\Input\Friday\Sales Tab - Adoption Report - Prod.xlsx")
x6.Visible = True
Set Xlsheet = XlBook.Worksheets("Weekly Trend")
Dim i, j As Integer
For i = 1 To 300
If Len(Xlsheet.Cells(3, i).Value) > 0 Then
j = i - 1
Else
Exit For
End If
Next i
Xlsheet.Range(Cells(3, j), Cells(24, j + 1)).Copy
Xlsheet.Range(Cells(3, j+2), Cells(24, j + 3)).Paste
I am getting an error at copying place.
Please help me in doing this.
Set x6 = CreateObject("Excel.application")
Set XlBook = x6.Workbooks.Open("C:\eCMSAutomatedReports\Input\Friday\Sales Tab - Adoption Report - Prod.xlsx")
x6.Visible = True
Set Xlsheet = XlBook.Worksheets("Weekly Trend")
Dim i, j As Integer
For i = 1 To 300
If Len(Xlsheet.Cells(3, i).Value) > 0 Then
j = i - 1
Else
Exit For
End If
Next i
Xlsheet.Range(Cells(3, j), Cells(24, j + 1)).Copy
Xlsheet.Range(Cells(3, j+2), Cells(24, j + 3)).Paste
I am getting an error at copying place.
Please help me in doing this.