Consulting

Results 1 to 2 of 2

Thread: Help - Macro to add data to workweeks

  1. #1
    VBAX Newbie
    Joined
    Jan 2021
    Posts
    1
    Location

    Help - Macro to add data to workweeks

    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

  2. #2
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,635
    Sub M_snb()
       UsedRange.Offset(, UsedRange.Columns.Count).Resize(8, 1) = Range("C38:C46").Value
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •