ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automate AutoFill in Column (https://www.excelbanter.com/excel-programming/337933-automate-autofill-column.html)

JTF

Automate AutoFill in Column
 
HI all

I have a formula in cell J2 that needs to be copied down to fill the
rest of column J. The problem is that the number of rows in the
worksheet will vary from month to month.

How do I indicate in the macro that the last row will vary? Thanks


Don Guillett[_4_]

Automate AutoFill in Column
 
lastrow=cells(rows.count,"j").end(xlup).row

--
Don Guillett
SalesAid Software

"JTF" wrote in message
oups.com...
HI all

I have a formula in cell J2 that needs to be copied down to fill the
rest of column J. The problem is that the number of rows in the
worksheet will vary from month to month.

How do I indicate in the macro that the last row will vary? Thanks




hideki[_10_]

Automate AutoFill in Column
 

Find the last row first

sub FillDownInJ()

dim lngLastRow as long

lngLastRow=Cells(rows.count,"J").end(xlup).Row

Range("J2:J" & lngLastRow).filldown

end su

--
hidek
-----------------------------------------------------------------------
hideki's Profile: http://www.excelforum.com/member.php...fo&userid=1890
View this thread: http://www.excelforum.com/showthread.php?threadid=39775



All times are GMT +1. The time now is 11:56 AM.

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