CokeOrCrack
Board Regular
- Joined
- Dec 13, 2015
- Messages
- 81
I am attempting to use a Command Button to insert a new TABLE row. The code I have successfully inserts an entire row instead of a TABLE row. The code I have is as follows:
Private Sub CommandButton1_Click()
Dim mySheets
Dim i As Long
mySheets = Array("General")
For i = LBound(mySheets) To UBound(mySheets)
With Sheets(mySheets(i))
.Range("B12").EntireRow.Insert Shift:=xlDown
.Range("B12:O12").Borders.Weight = xlThin
End With
Next i
End Sub
--------------------------------------------------------------------------------------------
Notes:
The sheet name is: General
The table name is: General
--------------------------------------------------------------------------------------------
Is there a way to code a VBA Command Button so it inserts only a TABLE row upon clicking instead of an entire sheet row?
I assume my error has something to do with Line 9 where it states ".EntireRow.Insert" but I don't know what I would edit it to.
Thanks
OJ
Private Sub CommandButton1_Click()
Dim mySheets
Dim i As Long
mySheets = Array("General")
For i = LBound(mySheets) To UBound(mySheets)
With Sheets(mySheets(i))
.Range("B12").EntireRow.Insert Shift:=xlDown
.Range("B12:O12").Borders.Weight = xlThin
End With
Next i
End Sub
--------------------------------------------------------------------------------------------
Notes:
The sheet name is: General
The table name is: General
--------------------------------------------------------------------------------------------
Is there a way to code a VBA Command Button so it inserts only a TABLE row upon clicking instead of an entire sheet row?
I assume my error has something to do with Line 9 where it states ".EntireRow.Insert" but I don't know what I would edit it to.
Thanks
OJ