Results 1 to 9 of 9

Cannot use Find on another worksheet

Threaded View

7over6 Cannot use Find on another... 02-14-2014, 02:22 PM
6StringJazzer Re: Cannot use Find on... 02-14-2014, 03:02 PM
7over6 Re: Cannot use Find on... 02-14-2014, 03:24 PM
ImStevenB Re: Cannot use Find on... 02-14-2014, 03:25 PM
7over6 Re: Cannot use Find on... 02-14-2014, 03:35 PM
ImStevenB Re: Cannot use Find on... 02-14-2014, 03:42 PM
7over6 Re: Cannot use Find on... 02-14-2014, 03:49 PM
7over6 Re: Cannot use Find on... 02-14-2014, 04:54 PM
ImStevenB Re: Cannot use Find on... 02-14-2014, 05:01 PM
  1. #1
    Registered User
    Join Date
    02-14-2014
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    5

    Cannot use Find on another worksheet

    I have a workbook with two sheets. I have one macro that saves the text of the active cell in sheet 1 for later use, the macro then switches to sheet 2 and using the find function I want it to search for the variable I just setup but I keep getting run-time error 91.

    Here is what I have:

    'First, I hand select the correct "terminal number" from sheet1 and store it's text and address
    TerminalRng = ActiveCell.Address
    
    TerminalStr = ActiveCell.Value
    
    'To check my variables are correct
    MsgBox "Terminal Range : " & TerminalRng
    MsgBox "Terminal Text : " & TerminalStr
    
    Sheets(2).Select
    
        MsgBox "Terminal on Sheet2 check : " & TerminalStr 'To make sure the variable is still valid after switching to sheet2
    
        Cells.Find(What:=TerminalStr, After:=ActiveCell, LookIn:=xlFormulas, _
            LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
            MatchCase:=False, SearchFormat:=False).Activate


    I get the run-time error 91 with the Find lines of code yellow and the arrow pointing at the last row. I've tried all kinds of variations (with and without Activate) of the find function and as long as it is searching in sheet2 for the variable that was made in sheet1 it will NOT work. If I do this same search on Sheet1 I get no error. Also if I change the string name in Find to the same exact text just with quotes on it it will find that text without problem in Sheet2. But if I use a string I get an error. So frusterating! I'm not even doing anything that complex.
    Once I get this to work I want to save the address where the string is found in Sheet2 and use that address later as well so some advice on how to get an address from a Find result would be great as well.
    Can someone help?

    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Last edited by 6StringJazzer; 02-14-2014 at 02:54 PM. Reason: code tags

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Loop to find data in a worksheet and copy into a different worksheet.
    By emily_k8_lewis in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-29-2013, 06:44 AM
  2. how to find data from other worksheet and display on other worksheet.....
    By krunal.pa in forum Excel - New Users/Basics
    Replies: 7
    Last Post: 10-13-2013, 02:49 PM
  3. [SOLVED] Find and copy to other worksheet if not find something else.
    By jnh0 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-13-2013, 12:25 AM
  4. Replies: 6
    Last Post: 02-23-2013, 10:37 PM
  5. Excel VBA find newest worksheet based on date/time stamp in worksheet name?
    By takchin.tc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-27-2012, 03:56 PM

Tags for this Thread

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