PDA

View Full Version : Help - Macro to add data to workweeks



Tyraenel
01-11-2021, 07:44 PM
Hello

Guys , I need help with macro.
I need to add data to current Work Week.

I have data output from pivot table and I need to copy the data to specific column.
For example column F is WW4 so I hit button and it will copy data to column F , next week I will hit button again and it will copy data to column G as it is WW5

Currently I have this code :


Sub Button()
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet


Set copySheet = Worksheets("Graf")
Set pasteSheet = Worksheets("Graf")


copySheet.Range("C38:C46").Copy
pasteSheet.Cells(1, Columns.Count).End(xlToLeft).Offset(1, 5).PasteSpecial xlPasteValues


Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub


And it will copy the data to column F but i won't continue to column G.

Can you please help ?

I don't have much experience with VBA
Thank you very much

snb
01-12-2021, 09:33 AM
Sub M_snb()
UsedRange.Offset(, UsedRange.Columns.Count).Resize(8, 1) = Range("C38:C46").Value
End Sub