I would like to know how to get this macro to end it's range when it comes across a blank cell.
This is the code I have so far:
Private Sub Worksheet_Calculate()
InsRowDown
End Sub
Public Sub InsRowDown()
Dim lngStartRow As Long
Dim lngEndRow As Long
Dim m As Integer
Dim n As Long
With ActiveSheet
'work from bottom up
'set start row
lngStartRow = Range("B" & CStr(Application.Rows.Count)).End(xlUp).Row
'set end row
lngEndRow = ????
'loop through all used rows in column B starting at bottom
For n = lngStartRow To lngEndRow Step -1
If IsNumeric(Range("B" & CStr(n)).Value) Then
'insert rows below
For m = 2 To Range("B" & CStr(n)).Value
Rows(n + 1).Insert
Next m
End If
Next n
End With
End Sub
What do I need to replace the ???? with so that it doesn't keep inserting rows beneath cells that have empty rows beneath them already?
Thanks in advance.
Bookmarks