macro fill down commands

schmooot

New Member
Joined
Dec 15, 2008
Messages
8
Basically I have Titles in Row 1 and formulas in row 2. A:3 through A:(pick a number) has data in it. I then use the fill down function to fill the formulas from B:2 C:2 E:2 and so on. I generally fill down by double clicking the fill square and it automatically fills as far down as the column beside it. I then created a macro to do this for me, how do I get the macro to fill down only as far as the column beside it?

Code:
Range("B2").Select
    Selection.AutoFill Destination:=Range("B2:B18")
Here is what I have so far which would be fine if the amount of rows in column A never changed.

I tried adding the IF ISBLANK into every formula and then making my range to B:9000 or something but a couple of my formulas are kissing the character limit and I can't get around it. I know I could just make another cell somewhere with some values and use references but my sheet is already very large and I need to keep it clutter free
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Try

Code:
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("B2").AutoFill Destination:=Range("B2:B" & LR)
 
Upvote 0
Try:

Code:
Dim LastRow As Long
LastRow = Range("A" & Rows.Count).End(xlUp).Row
Range("B2").AutoFill Destination:=Range("B2:B" & LastRow)
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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