+ Reply to Thread
Results 1 to 3 of 3

Cut and Paste Entire Row Based on Selection is Hanging when Selection is Not Found

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    Logan, Utah
    MS-Off Ver
    Excel 2007
    Posts
    8

    Red face Cut and Paste Entire Row Based on Selection is Hanging when Selection is Not Found

    So, it will be pretty obvious how new I am when you look at my unconventional code, but the code has worked perfectly up until I copied what I thought was a solution off of the forum. Daily I process a file that has some extreme formatting. This is a tiny piece of the pie. I am trying to find the word "BALTIMORE" and cut the entire row(s) that contain the selection and paste/insert the rows just above the first row with the word "THURMONT" in it. My code only works if BALTIMORE is found but hangs when it is not found. I would also like to insert 2 blank rows above insertion point. Thanks in advance for any pointers.

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Cut and Paste Entire Row Based on Selection is Hanging when Selection is Not Found

    Do you have a sample file that you can attach?

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    10-24-2012
    Location
    Logan, Utah
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Cut and Paste Entire Row Based on Selection is Hanging when Selection is Not Found

    Once again, if you run my code, everything works with this file because the word "BALTIMORE" is there. The problem comes when a file that does not have any instance of "BALTIMORE" is not there and it doesn't find it. So if you strip the word "BALTIMORE" from this file and then try running my code, it is pretty clear that it is missing something. I would actually like to add code that inserts 2 lines after the code has run between "LOGAN" and "THURMONT".

    Thanks for your help.
    Attached Files Attached Files

+ 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