+ Reply to Thread
Results 1 to 4 of 4

If sh.name=Ws.name issue

  1. #1
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    If sh.name=Ws.name issue

    A previous thread I answered, I was looping through the sheets, and if the sh.name<>w1.name or sh.name<>w2.name or sh.name<>w3.name then

    The code would not ignore the w1,w2,w3 worksheets, I had to use if then for each worksheet.

    If Or code
    Please Login or Register  to view this content.
    If then Code
    Please Login or Register  to view this content.
    I'm sure I have gotten this to work before.

    Check out the attached.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-01-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    1,795

    Re: If sh.name=Ws.name issue

    Quote Originally Posted by davesexcel View Post
    The code would not ignore the w1,w2,w3 worksheets, I had to use if then for each worksheet.
    [....]
    Please Login or Register  to view this content.
    Use And instead of Or, to wit:
    Please Login or Register  to view this content.
    But if the code is truly as it is written, not an simplified abstraction, you already know the worksheet names. Why not simply:
    Please Login or Register  to view this content.
    Or if you prefer more structure:
    Please Login or Register  to view this content.
    Last edited by joeu2004; 02-13-2015 at 03:36 AM. Reason: cosmetic

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,094

    Re: If sh.name=Ws.name issue

    You need to use And, not Or.


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: If sh.name=Ws.name issue

    And it is.

    I made the worksheet variables, thinking I was going to need them when I was going to paste to the Group Worksheets, turns out I didn't need them.

    Code would be as such.

    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)

Similar Threads

  1. [SOLVED] Insert shift down issue macro issue
    By CC64 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-15-2012, 10:57 PM
  2. Issue with X axis values NOT graphing on Scatter graph and issue with Labels
    By lmausolf in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-17-2012, 07:20 AM
  3. Issue - Image button issue - by JBeaucaire
    By Vaibhav in forum Suggestions for Improvement
    Replies: 2
    Last Post: 05-06-2012, 07:35 AM
  4. [SOLVED] Issue - Attachment issue - by Simon Lloyd
    By Vaibhav in forum Suggestions for Improvement
    Replies: 16
    Last Post: 03-16-2012, 06:56 PM
  5. [SOLVED] Issue -Joke thread issue - Mordred
    By Vaibhav in forum Suggestions for Improvement
    Replies: 2
    Last Post: 02-17-2012, 01:31 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