Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi Guys,
I'm trying to write in to a macro the ability to Autofill a column from a cell (H7) to LastRow as you can see below, but miss out rows that have no value in Column D. E.g. If LastRow is 20 D7 has value? Yes. Fill Row. D8 has value? Yes. Fill Row. D9 has value? No. Skip Row. D10 has value? Yes. Fill Row......... Code: Dim lastRow As Long lastRow = Range("A65536").End(xlUp).row Range("H7:H7").Select Selection.AutoFill Destination:=Range("H2:H" & lastRow) Can anyone help with this? Thanks Dave |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
let me know if this does not work for you
Dim lastRow As Long Dim startRow as Long Dim strData as String startRow=2 lastRow = Range("A65536").End(xlUp).row strData=Range(7,8) For i=startRow to lastRow If cells(i+5,4)<"" then cells(i,8)=strData 'if D7 has something H2=H7 Next -- -John Please rate when your question is answered to help us and others know what is helpful. "Dave" wrote: Hi Guys, I'm trying to write in to a macro the ability to Autofill a column from a cell (H7) to LastRow as you can see below, but miss out rows that have no value in Column D. E.g. If LastRow is 20 D7 has value? Yes. Fill Row. D8 has value? Yes. Fill Row. D9 has value? No. Skip Row. D10 has value? Yes. Fill Row......... Code: Dim lastRow As Long lastRow = Range("A65536").End(xlUp).row Range("H7:H7").Select Selection.AutoFill Destination:=Range("H2:H" & lastRow) Can anyone help with this? Thanks Dave |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Autofill counting up Columns and Rows! | Excel Worksheet Functions | |||
Macros or the Fastest way to Autofill Rows | Excel Discussion (Misc queries) | |||
Need help wiht a macro for autofill rows | Excel Worksheet Functions | |||
AutoFill down X number of rows. | Excel Discussion (Misc queries) | |||
AutoFill over 30,000 rows | Excel Worksheet Functions |