VBA to drag formulas into next blank column

Kieran1995

New Member
Joined
Mar 12, 2018
Messages
3
Hi,

I'm looking to use a macro to drag formulas from the end column to the next blank column and then paste values on the previous column.

For example, column V contains the formulas at first. I want to then drag these formulas into column W and Paste Values in column V, but I want to write the code in a way that when it comes to using the macro again the formulas that are now in column W will be dragged into column X and then have their values pasted in column X.

This is what I've got so far:

Code:
Sub RollFile()

    Columns("V3:V114").Select
    Selection.AutoFill Destination:=Columns("V3:W114"), Type:=xlFillDefault
    Columns("V3:V114").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Range("W2").Select
    
End Sub

Any help would be great.
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi & welcome to the board.
If it's always the last col you want to copy try
Code:
Sub RollFile()
   Dim UsdCols As Long
   
   UsdCols = Cells(3, Columns.Count).End(xlToLeft).Column
   With Range(Cells(3, UsdCols), Cells(114, UsdCols))
      .Copy .Offset(, 1)
      .Value = .Value
      .Offset(-1, 1)(1).Select
   End With
    
End Sub
 
Upvote 0
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,200
Members
453,022
Latest member
RobertV1609

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