Insert Column VBA with Button

HMCCRAINE

New Member
Joined
Jul 13, 2023
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi, I'm running that copies and inserts a column using a button. However, I want the macro to increase the destination by one, ex. after it inserts in column 12 I want the next click to insert in column 13 then 14 and so on. Instead of it continuously inserting in column 12 and pushing everything to the right.

Sub Button4_Click()
Application.CutCopyMode = False

With Worksheets("FTS")
.Columns(11).COPY
.Columns(12).INSERT Shift:=xlShiftDown
End With

Application.CutCopyMode = True
End Sub
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
VBA Code:
Sub Button4_Click()
Application.CutCopyMode = False

With Worksheets("FTS")
.Columns(11).COPY
.Columns(12).INSERT Shift:=xlShiftDown
End With

Application.CutCopyMode = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,336
Messages
6,124,334
Members
449,155
Latest member
ravioli44

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