Ksandra2901
New Member
- Joined
- Jan 3, 2012
- Messages
- 8
Hi All
Long time lurker, I've managed to cobble something together from various bits of advice on here, but I just need advice on this last bit....
I have a sheet with columns of data all 34 rows long (managed to find code that turned a long list of numbers into multiple custom sized columns).
The idea is to take each of these columns of 34 locations and put them into a template file that ultimately creates a report for a team to print and check.
So essentially I need to copy and paste each of the columns from one sheet to specific locations on another sheet that could be anything up to 30 cell locations on up to 10 pages?
I hope that makes sense? I am a VBA newbie and I would very much appreciate if an explanation of what each line is doing, so it could help me to learn how to do this myself again at a later date
This is what I have so far, which is copying and pasting like for like on the second sheet, but I need to paste to locations like B7, F7, J7 then drop down to B44, F44, J44 on the next page and repeat until the data runs out? The locations on the receiving sheet will all still be in cols B F and J it will just be the row number that changes?
Source example:
Required Result:
I'm sure it's super easy and I will kick myself but I am stumped....
TIA
Long time lurker, I've managed to cobble something together from various bits of advice on here, but I just need advice on this last bit....
I have a sheet with columns of data all 34 rows long (managed to find code that turned a long list of numbers into multiple custom sized columns).
The idea is to take each of these columns of 34 locations and put them into a template file that ultimately creates a report for a team to print and check.
So essentially I need to copy and paste each of the columns from one sheet to specific locations on another sheet that could be anything up to 30 cell locations on up to 10 pages?
I hope that makes sense? I am a VBA newbie and I would very much appreciate if an explanation of what each line is doing, so it could help me to learn how to do this myself again at a later date
This is what I have so far, which is copying and pasting like for like on the second sheet, but I need to paste to locations like B7, F7, J7 then drop down to B44, F44, J44 on the next page and repeat until the data runs out? The locations on the receiving sheet will all still be in cols B F and J it will just be the row number that changes?
VBA Code:
Option Explicit
Sub Loop_Test()
Dim LCol As Long, x As Long
Dim sh1 As Worksheet, sh2 As Worksheet
Set sh1 = Sheets("Helper")
Set sh2 = Sheets("Copy_Location")
sh1.Select
Range("A1").Select
LCol = ActiveSheet.Cells.Find("*", SearchOrder:=xlByColumns, SearchDirection:=xlPrevious).Column
For c = 1 To LCol
sh1.Cells(1, c).Select
Range(Selection, Selection.End(xlDown)).Copy
sh2.Cells(1, c).PasteSpecial
Next
End Sub
Source example:
Required Result:
I'm sure it's super easy and I will kick myself but I am stumped....
TIA