+ Reply to Thread
Results 1 to 10 of 10

How to refer to more than one sheet with With Sheets

  1. #1
    Registered User
    Join Date
    12-01-2012
    Location
    Barrie
    MS-Off Ver
    Excel 2010
    Posts
    7

    How to refer to more than one sheet with With Sheets

    I am new to VBA and I have a code right now that works, only if it looks in sheet9 for the match, however i would like to look in sheet 10 and sheet 11 as well. Thank you for your help.

    My code:
    Please Login or Register  to view this content.

    Moderator's Note: Welcome to the forum. Codes are supposed to be enclosed with code tags. Select he code then hit "#" sign. I'll do it for now thank you.
    Last edited by vlady; 12-02-2012 at 07:23 PM. Reason: code tags

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: How to refer to more than one sheet with With Sheets

    Hi

    Firstly, can you please review the forum rules regarding code tags, and then edit your post to wrap your code.

    Then try

    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    12-01-2012
    Location
    Barrie
    MS-Off Ver
    Excel 2010
    Posts
    7

    Red face Re: How to refer to more than one sheet with With Sheets

    Hi Rylo,

    Thank you for your help and your advice on the forum rules. I will do it next time. Your code works except I would like for it to find the cell value in any of those 3 sheets without having to tell me that it doesnt exist in the other worksheets.

    Thank you again.

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: How to refer to more than one sheet with With Sheets

    Hi

    I have it set up, as per your original code, that if it finds a match, then it will move to that position. So if you have 3 sheets, the match is on the second sheet, exactly what do you want to happen?

    rylo

  5. #5
    Registered User
    Join Date
    12-01-2012
    Location
    Barrie
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to refer to more than one sheet with With Sheets

    I would like for it to go to the second sheet where the match is.

    Mario

  6. #6
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: How to refer to more than one sheet with With Sheets

    That is what it was doing on my test file.

    So I can see exactly what your structure is, can you please attach an example file.

    rylo

  7. #7
    Registered User
    Join Date
    12-01-2012
    Location
    Barrie
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to refer to more than one sheet with With Sheets

    005.02.2 Commitment LA1.xls

    Hi Rylo,

    Here is my file (Hope it uploaded okay). There are other worksheets in the workbook, but at this time I am only concerned with sheets 8,9,10,11.

    Thank you once again

    Mario

  8. #8
    Registered User
    Join Date
    11-26-2012
    Location
    Kitchener, Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: How to refer to more than one sheet with With Sheets

    One way is to use a boolean variable as follows
    Please Login or Register  to view this content.
    I fixed your file and re-attached it again
    Attached Files Attached Files
    aelgadi

    > Click Star if I helped. Thanks

  9. #9
    Registered User
    Join Date
    12-01-2012
    Location
    Barrie
    MS-Off Ver
    Excel 2010
    Posts
    7

    Re: How to refer to more than one sheet with With Sheets

    aelgadi,

    It works like a charm. Thank you so much.

  10. #10
    Registered User
    Join Date
    11-26-2012
    Location
    Kitchener, Ontario, Canada
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: How to refer to more than one sheet with With Sheets

    If satisfied with a solution, don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)

    aelgadi

    >>> If I helped, don't forget to add to my reputation (click on the star at left bottom of the post)

+ 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