+ Reply to Thread
Results 1 to 4 of 4

Deleting Rows using VBA

  1. #1
    Registered User
    Join Date
    08-24-2005
    Posts
    22

    Deleting Rows using VBA

    All I have found as far as tutorials is how to delete empty rows by using a calculation to determine if the row is empty. Is there any way to simply say, "delete row 3" or something of that nature. Based on user input I will know the exact row number to delete and this would help alot. thanks.

  2. #2
    Arvi Laanemets
    Guest

    Re: Deleting Rows using VBA

    Hi

    ....
    Worksheets("SheetName").Rows(RowNumber1 & ":" & RowNumber2).Delete
    Shift:=xlUp
    ....

    (the worksheet mustn't be activated)

    --
    Arvi Laanemets
    ( My real mail address: arvil<at>tarkon.ee )



    "SystemHack" <[email protected]> wrote
    in message news:[email protected]...
    >
    > All I have found as far as tutorials is how to delete empty rows by
    > using a calculation to determine if the row is empty. Is there any way
    > to simply say, "delete row 3" or something of that nature. Based on
    > user input I will know the exact row number to delete and this would
    > help alot. thanks.
    >
    >
    > --
    > SystemHack
    > ------------------------------------------------------------------------
    > SystemHack's Profile:
    > http://www.excelforum.com/member.php...o&userid=26614
    > View this thread: http://www.excelforum.com/showthread...hreadid=400351
    >




  3. #3
    Bob Phillips
    Guest

    Re: Deleting Rows using VBA

    ans = InputBox("Delete which row?")
    Rows(ans).Delete

    --

    HTH

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


    "SystemHack" <[email protected]> wrote
    in message news:[email protected]...
    >
    > All I have found as far as tutorials is how to delete empty rows by
    > using a calculation to determine if the row is empty. Is there any way
    > to simply say, "delete row 3" or something of that nature. Based on
    > user input I will know the exact row number to delete and this would
    > help alot. thanks.
    >
    >
    > --
    > SystemHack
    > ------------------------------------------------------------------------
    > SystemHack's Profile:

    http://www.excelforum.com/member.php...o&userid=26614
    > View this thread: http://www.excelforum.com/showthread...hreadid=400351
    >




  4. #4
    Tom Ogilvy
    Guest

    Re: Deleting Rows using VBA

    ans = InputBox("Delete which row?")
    On Error Resume next
    set rng = Rows(ans)
    On errror goto 0
    if not rng is nothing then
    rng.Delete
    end if

    --
    Regards,
    Tom Ogilvy


    "SystemHack" <[email protected]> wrote
    in message news:[email protected]...
    >
    > All I have found as far as tutorials is how to delete empty rows by
    > using a calculation to determine if the row is empty. Is there any way
    > to simply say, "delete row 3" or something of that nature. Based on
    > user input I will know the exact row number to delete and this would
    > help alot. thanks.
    >
    >
    > --
    > SystemHack
    > ------------------------------------------------------------------------
    > SystemHack's Profile:

    http://www.excelforum.com/member.php...o&userid=26614
    > View this thread: http://www.excelforum.com/showthread...hreadid=400351
    >




+ 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