Dragging formula across using a macro?

LemonyMidget

New Member
Joined
Sep 14, 2016
Messages
4
Hello,

So I need my formulas to be dragged across to the next column using a macro but I'm finding it really hard.

I've got a few tabs I need to do this on as well,
E.g On the 'ACE' tab I need from AS46:AS86 to be dragged across one column to AT46:AT86, but then the next time I need it to go from AT - AU etc etc, I'm having a lot of trouble working out the basics of how to do this.

Any help would be great, thanks
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
How do you intend to tell the macro which column is the correct column to use?
 
Upvote 0
No how do you identify it's the correct column? How do you know you need to move from AT-AU? Is it the last used column for example? Is AT46 the last used cell in row 46??
 
Upvote 0
Ooooh haha, I'm sorry! Yes, so AS46:AS86 currently have formulas in them/data in them, AT is blank, so next week I need the formula to be dragged across to AT and fill the data in, and then the week after that AT will be the last column to have data in so those formulas need to be dragged to AU as that one will be the next blank column. I apologise if I'm not being very clear, I'm awful at putting what I need into words.
 
Upvote 0
See if this works for you:

Code:
lc = Cells(46, Columns.Count).End(xlToLeft).Column
Range(Cells(46, lc), Cells(86, lc)).Copy Range(Cells(46, lc + 1), Cells(86, lc + 1))
 
Upvote 0

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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