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

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
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,214,641
Messages
6,120,694
Members
448,979
Latest member
DET4492

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