Janspook03
New Member
- Joined
- May 13, 2024
- Messages
- 2
- Office Version
- 365
- Platform
- Windows
Hi everyone,
I'm an excel newbie and trying to figure out how to make something work in VBA. Y'all seem like a really nice bunch, so I'm hoping you can help me out!
I've managed to automatically create a pivot table containing days worked per week per person from a raw data file and would like to create a macro that will automatically show the values of that pivot table into an overview. So I can collect the data for every month in one sheet.
To achieve this, I figured I could use a VLookUp code that transfers the data from my pivot table to the overview adding 4 to 5 weeks every month.
I got this far from another guide I found online:
But I can't figure out how to change the code to add the vlookup to the next blank column.
(every time I try to add an .End(x1Up) or other things I've seen in other posts, it just doesn't work.)
If anyone can help me to make sense of it all, it would be greatly appreciated!
I'm an excel newbie and trying to figure out how to make something work in VBA. Y'all seem like a really nice bunch, so I'm hoping you can help me out!
I've managed to automatically create a pivot table containing days worked per week per person from a raw data file and would like to create a macro that will automatically show the values of that pivot table into an overview. So I can collect the data for every month in one sheet.
To achieve this, I figured I could use a VLookUp code that transfers the data from my pivot table to the overview adding 4 to 5 weeks every month.
I got this far from another guide I found online:
VBA Code:
Sub VLOOKUPAnotherSheet()
For Each cell In ThisWorkbook.Sheets("Pastetest").Range("A2:A2000")
cell.Offset(0, 1) = Application.VLookup(cell, Sheets("Pivot Sheet").Range("A3:B2000"), 2, False)
Next
End Sub
But I can't figure out how to change the code to add the vlookup to the next blank column.
(every time I try to add an .End(x1Up) or other things I've seen in other posts, it just doesn't work.)
If anyone can help me to make sense of it all, it would be greatly appreciated!