ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filldown code (https://www.excelbanter.com/excel-programming/419458-filldown-code.html)

aileen

Filldown code
 
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.

Dave Peterson

Filldown code
 
Maybe...

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



aileen wrote:

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.


--

Dave Peterson

aileen

Filldown code
 
That worked perfectly. Thanks!

"Dave Peterson" wrote:

Maybe...

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



aileen wrote:

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.


--

Dave Peterson



All times are GMT +1. The time now is 02:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com