Fill down comes up with debug error.

Weronika

Board Regular
Joined
Jul 5, 2009
Messages
69
Hi All,

Would someone be able to help me out with an excel 2007 macro please? My macro works fine, but sometimes it come up with debug error, because of fill the cells down based on count of rows in the other column:
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("E2").AutoFill Destination:=Range("E2:E" & LR)

if there is no cells to fill down it just stops. I have tried to use
Selection.AutoFill Destination:=Range("E2:E65536")
but then it works very, very slow. Is there any other solution to get that work properly at all the times.

Thanks for any help.
Weronika
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Try

Code:
LR = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
If LR > 2 Then Range("E2").AutoFill Destination:=Range("E2:E" & LR)
 
Upvote 0

Forum statistics

Threads
1,224,548
Messages
6,179,443
Members
452,915
Latest member
hannnahheileen

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