teatimecrumpet
Active Member
- Joined
- Jun 23, 2010
- Messages
- 307
Hi,
I'm trying to copy a range of cells in every third column and then paste it into another sheet in different rows different columns (but still every third row.
My code prompts the user to browse for and open a file to copy from and pastes it into another workbook already defined as "inwkb".
so basically it needs to match the first processed k column to the first processed q column and so on and so forth.
I keep getting the subscript out of range for the highlighted code.
Any help is much appreciated.
THANKS!
My code:
I'm trying to copy a range of cells in every third column and then paste it into another sheet in different rows different columns (but still every third row.
My code prompts the user to browse for and open a file to copy from and pastes it into another workbook already defined as "inwkb".
so basically it needs to match the first processed k column to the first processed q column and so on and so forth.
I keep getting the subscript out of range for the highlighted code.
Any help is much appreciated.
THANKS!
My code:
FileToOpen = Application.GetOpenFilename("Excel Files (*.xls), *.xls")
If FileToOpen = False Then Exit Sub
Set OutWkb = Workbooks.Open(Filename:=FileToOpen)
Dim q As Integer
For q = 5 To 254 Step 3
Dim k As Integer
For k = 5 To 254 Step 3
Cells(15, k).Select
Range(Selection, Cells(32, k)).Select
Selection.Copy Destination:=InWkb.Sheets("New").Cells(67, q)
Next k
Next q