Excel Add Blank Rows With Checkbox Or Button

Excel VBA Add Blank Rows

            New blank rows can be added under each row with checkbox and button controls . Blank rows can be deleted with the deleting button.
The new rows are added as blank rows under each rows.

 The used codes to add - remove rows with checkbox :
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Call Addrow
Call Clr
End If
End Sub

Sub Addrow()     ' The main procedure that allows us to add blank rows under filled rows
Dim a As Byte
Dim c As Integer
a = 2
c = 0
While ActiveCell.Value <> ""
c = c + 2
ActiveSheet.Rows(c).Insert Shift:=xlDown
ActiveCell.Offset(a, 0).Select
End Sub

Sub Clr()
On Error Resume Next
End Sub

Excel VBA Add Row

 The used codes to add - remove rows with buttons :
Private Sub CommandButton1_Click()
Call Addrow
End Sub

Private Sub CommandButton2_Click()
Call Clr
End Sub
excel vba add blank row
excel vba add blank rows

No comments:

Post a Comment