Hope Everyone is well,
I'm trying to do something very simple - I am using the code below to add a new row on the top row by clicking a Command Button. I'm having a hard time also including the format, some cells on the row have to be a specific format (Text, Date, Currency, Center aligned, etc.) Note: I'm using an auto expand table.
This is the code i am using:
Private Sub CommandButton1_Click()
Dim mySheets
Dim i As Long
mySheets = Array("Sheet1")
For i = LBound(mySheets) To UBound(mySheets)
With Sheets(mySheets(i))
.Range("B8").EntireRow.Insert shift:=x1Down
.Range("B8:D8").Borders.Weight = xlThin
End With
Next i
End Sub
----------------------
I got this code from a search to add a new row online, so I am trying to build off of it.
Thank you for all the help.
xluser26
I'm trying to do something very simple - I am using the code below to add a new row on the top row by clicking a Command Button. I'm having a hard time also including the format, some cells on the row have to be a specific format (Text, Date, Currency, Center aligned, etc.) Note: I'm using an auto expand table.
This is the code i am using:
Private Sub CommandButton1_Click()
Dim mySheets
Dim i As Long
mySheets = Array("Sheet1")
For i = LBound(mySheets) To UBound(mySheets)
With Sheets(mySheets(i))
.Range("B8").EntireRow.Insert shift:=x1Down
.Range("B8:D8").Borders.Weight = xlThin
End With
Next i
End Sub
----------------------
I got this code from a search to add a new row online, so I am trying to build off of it.
Thank you for all the help.
xluser26