+ Reply to Thread
Results 1 to 3 of 3

How do I write a macro in XL that will delete 1st row and save th.

  1. #1
    Nitin
    Guest

    How do I write a macro in XL that will delete 1st row and save th.

    I would like to create a macro that deletes the the first row or the first
    two rows and saves the file with a new predefined name and location.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Nitin,

    To delete a given row by it's row number...

    Activesheet.Rows(1).Delete (This delete row 1 on the active sheet)

    To Save the Workbook to New Location...

    'Save the Current Directory
    OldDir = CurDir

    'Change Directory to Our New Location
    ChDir("C:\Program Files\New Folder\")

    'Save the Workbook
    Workbook.Save

    'Restore Original Directory
    ChDir(OldDir)

    Hope this helps,
    Leith Ross

  3. #3
    Bob Phillips
    Guest

    Re: How do I write a macro in XL that will delete 1st row and save th.


    With Activeworkbook
    .Worksheets("Sheet1").Rows("1:2").Delete
    .SaveAs Filename:= myFile
    End With

    where myFile is the predefined name.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Nitin" <[email protected]> wrote in message
    news:[email protected]...
    > I would like to create a macro that deletes the the first row or the first
    > two rows and saves the file with a new predefined name and location.




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1