+ Reply to Thread
Results 1 to 5 of 5

replacing sheet("XX").Select with for Loop Worksheet Name

  1. #1
    Forum Contributor
    Join Date
    10-16-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    112

    replacing sheet("XX").Select with for Loop Worksheet Name

    Here is the For Loop I used to to find the name and range for a Workbook

    Please Login or Register  to view this content.
    But now how do I just replace the Workbook with the following code above with the one below with If (Left(wsh.Name, 3) = "001")

    Please Login or Register  to view this content.
    Last edited by Jerseynjphillypa; 08-03-2012 at 10:01 AM.

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: replacing sheet("XX").Select with for Loop Worksheet Name

    I don't understand what you are trying to do - can you post your actual code?

    There shouldn't really ever be a need to select anything

  3. #3
    Forum Contributor
    Join Date
    10-16-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: replacing sheet("XX").Select with for Loop Worksheet Name

    My code is finding the worksheet with the "001" name and creating a pivot table with the range.

    But I have to re click on the worksheet so i can convert column F into a number

    Please Login or Register  to view this content.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: replacing sheet("XX").Select with for Loop Worksheet Name

    Sorry I still really don't understand what you're trying to do/what the problem is.

    There's no need to select anything, maybe:
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    10-16-2011
    Location
    US
    MS-Off Ver
    Excel 2007
    Posts
    112

    Re: replacing sheet("XX").Select with for Loop Worksheet Name

    Sorry for being unclear but I am trying to make a universal code that will work with my other excel files. So i can just copy and paste the macro into the files without changing the tab name

    Since these are the two tab name for each workbook. So that why I created a for loop to search for 001 in the tab name.

    Please Login or Register  to view this content.
    and
    Please Login or Register  to view this content.


    ---------- Post added at 10:01 AM ---------- Previous post was at 10:00 AM ----------

    I used the following code below which worked out

    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