View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] RichardRosema@googlemail.com is offline
external usenet poster
 
Posts: 3
Default Fill down formula if other column contains data

Hi

I'm trying to get a macro to fill down formulas in 2 columns when a
new row is inserted, depending on whether there is data in column B.
i.e. Only fill down in columns W and X if B is not empty for that row.

I've tried hashing a sub together from another thread but without
luck. (Rows 1 to 7 contain heading information, etc.)
Any help would be appreciated.
My hashed sub (as a shockingly novice user) is this:

Sub fill_formula_until_end()

' Copy Formula W7 & then paste down until empty Rows
Range("W7").Select
Row = 2
Do Until IsEmpty(Cells(Row, 2))
Cells(Row, 23).Select
Selection.FillDown
Row = Row + 1
Loop
Row = Row - 1

' Copy Formula X7 & then paste down until empty Rows
Range("X7").Select
Selection.Copy
Row = 2
Do Until IsEmpty(Cells(Row, 2))
Cells(Row, 24).Select
ActiveSheet.Paste
Row = Row + 1
Loop
Row = Row - 1

End Sub

I'll be honest and admit that I'm not sure where in the above code it
checks if column B is empty or not, to know whether a fill down would
apply.

P.S. I can't use the copy formula because I'm using the following
private sub in the workbook:
Application.CutCopyMode = False
Application.CellDragAndDrop = False