[VBA Question]: Copy/paste every single quarter - replicate 40 times in a quarter

fjacruz

New Member
Joined
Feb 15, 2019
Messages
8
Hi guys,

I'm not particular specialist on vba code but it'd be great if I got a automatization here.
Every single quarter I need to copy a paste (to break formulas) a specific column (lets assume D column) to the first column to the right...the idea behind is add a new column to the structure every single quarter so i've to find to code in a way to find the next empty column. On top of that, i need to replicate it 40 times per quarter. All tabs are starting by same name lets assume (Resume xxx). Firstly i need to update computation across the 40 tabs and then execute it.

I appreciate all valuable input.

Thank you
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Perhaps something along these lines? (Test it on a backup copy of your workbook)

VBA Code:
Sub MyCopy()

    Dim ws As Worksheet
    
    For Each ws In ThisWorkbook.Worksheets
        If Left(ws.Name, 6) = "Resume" Then
            ws.Range("D:D").Copy
            'Assumes first empty column is to the right of last populated cell in row 1
            With ws.Cells(1, Columns.Count).End(xlToLeft).Offset(, 1)
                .PasteSpecial Paste:=xlPasteValues
                .PasteSpecial Paste:=xlPasteFormats
            End With
        End If
    Next ws

End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top