Results 1 to 2 of 2

Thread: Need to insert row in spreadsheet using VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    1

    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.

  2. #2
    Frenzied Member DKenny's Avatar
    Join Date
    Sep 2005
    Location
    on the good ship oblivion..
    Posts
    1,171

    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:
    1. Range("A5").EntireRow.Insert xlShiftDown

    To add headers and footer you should use the PageSetup object of the WorkSheet.
    e.g.
    VB Code:
    1. 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
    Declan

    Don't forget to mark your Thread as resolved.
    Take a moment to rate posts that you think are helpful

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width