+ Reply to Thread
Results 1 to 4 of 4

Message Box to find specific row then delete all others

  1. #1
    Forum Contributor mccrimmon's Avatar
    Join Date
    02-19-2004
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    249

    Message Box to find specific row then delete all others

    Hi

    I am wondering if anyone can help

    Im looking to have a messagebox on my macro that takes me to a specific row as a result of the row entered in the messagebox.

    I then want it to delete all data before this row and all data after this row in order to only leave the row that was specified as a result of the messagebox.

    Thanks
    McCrimmon

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

    It Exits
    if a number is entered
    A decimal number is entered
    A 0 or value greater than the number or rows on the sheet

    Please Login or Register  to view this content.
    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.

  3. #3
    Forum Contributor mccrimmon's Avatar
    Join Date
    02-19-2004
    Location
    Scotland
    MS-Off Ver
    2003
    Posts
    249
    Thanks for this.

    Have you got an example of what I would enter in the message box?

    I want to keep Row 94 for example, however, when I enter 94 or A94 in the messagebox, nothing appears to happen?

    Thanks again
    Much appreciated

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    It worked when I tested using low numbers like 4 & 5
    I did not test using higher numbers so did not pickup that I needed to convert the number entered in the message box from a string value to a numeric value

    Try this version

    The macro will only run if whole numeric numbers are entered
    e.g
    5
    95
    266

    Please Login or Register  to view this content.

+ 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