07-27-2023, 09:11 AM
Example:
Sub InsertAndFillRow()
Rows(2).Insert Shift:=xlDown
Range("A2").Value = "John"
Range("B2").Value = 25
Range("C2").Value = "Sales"
End Sub
Explanation:
The code defines a subroutine named InsertAndFillRow.
Rows(2).Insert Shift:=xlDown inserts a new row at the second row and shifts the existing rows down to make space for the new row.
Range("A2").Value = "John" sets the value "John" in cell A2.
Range("B2").Value = 25 sets the value 25 in cell B2.
Range("C2").Value = "Sales" sets the value "Sales" in cell C2.
Sub InsertAndFillRow()
Rows(2).Insert Shift:=xlDown
Range("A2").Value = "John"
Range("B2").Value = 25
Range("C2").Value = "Sales"
End Sub
Explanation:
The code defines a subroutine named InsertAndFillRow.
Rows(2).Insert Shift:=xlDown inserts a new row at the second row and shifts the existing rows down to make space for the new row.
Range("A2").Value = "John" sets the value "John" in cell A2.
Range("B2").Value = 25 sets the value 25 in cell B2.
Range("C2").Value = "Sales" sets the value "Sales" in cell C2.
Also follow me on Youtube for videos about video games:
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos
https://www.youtube.com/channel/UCxfkGVU...2mQ/videos