+ Reply to Thread
Results 1 to 9 of 9

how to delete the row if index is known

  1. #1
    Registered User
    Join Date
    05-27-2008
    Posts
    25

    how to delete the row if index is known

    i know the index of the row i want to delete the row and move to the cell below it and run this for loop till the last cell in the cloloumn... i am using the code given below.. please tell me what is wrong

    Please Login or Register  to view this content.
    Last edited by hotmalepiyush; 06-13-2008 at 07:21 AM.

  2. #2
    Registered User
    Join Date
    06-12-2008
    Location
    Newbury
    MS-Off Ver
    Office 365 ProPlus
    Posts
    92
    Replace:

    Please Login or Register  to view this content.
    with

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    hotmalepiyush


    Please take a couple of minutes and read the Forum Rules then wrap your VBA code (Rule 3)

    You have previously been asked to read & follow the forum rules

    If you agree to following the rules please wrap your VBA code and reply to this thread that you agree to follow the rules
    Last edited by mudraker; 06-13-2008 at 07:24 AM.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  4. #4
    Registered User
    Join Date
    05-27-2008
    Posts
    25
    i did try to put tags for code... in some sites u dont have to type the end tag if thats the last thing in the post so i did not type[/] tag... i will follow from hereafter

  5. #5
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    hotmalepiyush

    thanks for wrapping your VBA code & replying

    chergh's reply has been restored

  6. #6
    Registered User
    Join Date
    05-27-2008
    Posts
    25
    i changed the code... the code is now giving different results depending on which coloumn the active cell is when i run it

    i want a code which runs from D5 to the last cell in that coloumn that has some value.. n delete all rows that do not have EQ as value in that coloumn.
    plz suggest why i m not getting the desired result.

    piyush

  7. #7
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    When deleteing rows it is best to work in reverse - starting at the last row and working down to row 5

    The reason for this is when you delete a row the next row becomes the row you just deleted

    e;g
    Your macro is looking at d12
    Delete row 12, row 13 becomes the new row 12
    Your macro was looking at the old d12 and does not look at the new d12 then with the next loop moves on to the new d13

    try

    Please Login or Register  to view this content.
    Last edited by mudraker; 06-13-2008 at 06:17 PM.

  8. #8
    Registered User
    Join Date
    06-12-2008
    Location
    Newbury
    MS-Off Ver
    Office 365 ProPlus
    Posts
    92
    Try using this instead:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    05-27-2008
    Posts
    25
    thanx a lot

+ 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