S
Sam Kuo
I use the "Do Until...Loop" in forms subroutine to insert a row in worksheet
at specified location. How do I get the row number of the new row?
Private Sub cmdInsertRow_Click()
Dim ws As Worksheet
Dim a As Long
Set ws = Worksheets("Sheet1")
a = 22 'data starts at row 22
Do Until Trim(ws.Cells(a, 1)) = ""
If ws.Cells(a, 1) = Me.cboRefValue.Value Then
ws.Cells(a + 1, 1).EntireRow.Insert
a = a + 2
Else
a = a + 1
End If
Loop
End Sub
at specified location. How do I get the row number of the new row?
Private Sub cmdInsertRow_Click()
Dim ws As Worksheet
Dim a As Long
Set ws = Worksheets("Sheet1")
a = 22 'data starts at row 22
Do Until Trim(ws.Cells(a, 1)) = ""
If ws.Cells(a, 1) = Me.cboRefValue.Value Then
ws.Cells(a + 1, 1).EntireRow.Insert
a = a + 2
Else
a = a + 1
End If
Loop
End Sub