Need to insert row in spreadsheet using VB
Hello All,
I am new to excel programming but now am trying to insert row in spreadsheet using VBA programming.I am using Access 97.How can
I insert any row in the spreadhsheet using VBA code.I actually want
to add header and footer to the spreadsheet and also may need to
insert row in between the sheet.Please anyone can paste the code
snippet as I am new to syntax.
Thanks in advance.
Re: Need to insert row in spreadsheet using VB
To insert a row use the following code. The row is inserted above the range specified.
VB Code:
Range("A5").EntireRow.Insert xlShiftDown
To add headers and footer you should use the PageSetup object of the WorkSheet.
e.g.
VB Code:
Worksheets("Sheet1").PageSetup.LeftHeader = "Finance Report 1"
Other properties of the PageSetup object include the CenterHeader, RightHeader, LeftFooter, etc.
You should also look in the VBA help files for the special Formating Codes used in Headers and Footers e.g. &D = Print Date