Filldown code

A

aileen

I am using filldown code that works perfectly in most cases. However,
sometimes the workbook I create has 0 or 1 row of data. I never know when
this will happen because I am automatically creating the workbook based on
differences between two other workbooks. Is there a way to tell the filldown
code only to work if there is more than 1 row of data in a workbook?

Here is the code I am using now:

With ActiveSheet
Lrow = Range("A" & Rows.Count).End(xlUp).Row
Range("F1:F" & Lrow).FillDown
End With

Thanks for any help.
 
D

Dave Peterson

Maybe...

With ActiveSheet
Lrow = .Range("A" & .Rows.Count).End(xlUp).Row
if lrow > 1 then
.Range("F1:F" & Lrow).FillDown
end if
End With
 
A

aileen

That worked perfectly. Thanks!

Dave Peterson said:
Maybe...

With ActiveSheet
Lrow = .Range("A" & .Rows.Count).End(xlUp).Row
if lrow > 1 then
.Range("F1:F" & Lrow).FillDown
end if
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top