Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Tab Wildcard

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Posts
    59
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a macro that is opening several spreadsheets, pulling data out and pasting it into a new spreadsheet. The problem is that the tab that I am pulling from has a different name and location in each spreadsheet that I am opening. My question is, I know that I can tell the macro to prompt me as what spreadsheet to open, but can I prompt the tab also??

    Or, each spreadsheet that I am opening to pull data from, while all the tabs have different names, but they have the same three letters at the end of the tab name (UPL), can I wildcard it and tell the macro to look and pull from any spreadsheet containing the letters UPL ??

    I'm stumped....Any advice would be appreciated! thanks!

  2. #2
    MrExcel MVP Barrie Davidson's Avatar
    Join Date
    Feb 2002
    Location
    Winnipeg
    Posts
    2,330
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-02-18 04:55, mcmba wrote:
    I have a macro that is opening several spreadsheets, pulling data out and pasting it into a new spreadsheet. The problem is that the tab that I am pulling from has a different name and location in each spreadsheet that I am opening. My question is, I know that I can tell the macro to prompt me as what spreadsheet to open, but can I prompt the tab also??

    Or, each spreadsheet that I am opening to pull data from, while all the tabs have different names, but they have the same three letters at the end of the tab name (UPL), can I wildcard it and tell the macro to look and pull from any spreadsheet containing the letters UPL ??

    I'm stumped....Any advice would be appreciated! thanks!
    You could try something like:
    Code:
    Dim ws As Worksheet
    
    For Each ws In ActiveWorkbook
        If Right(ws.Name,3) = "UPL" Then
        'the rest of your code
        End If
    Next ws
    Hope this is what you need

    _________________

    Barrie Davidson
    My Excel Web Page

    [ This Message was edited by: Barrie Davidson on 2002-02-18 05:07 ]

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Posts
    59
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    That's perfect!! Thanks!

  4. #4
    Guest

    Default

    Pandarus gave you exactly the same reply as Barrie's (at :- htttp://www.mrexcel.com/wwwboard/messages/23147.html) when you posted this question before.

  5. #5
    Board Regular
    Join Date
    Feb 2002
    Posts
    59
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Sorry, I did not realize that I had already posted this before! It has been a crazy week for me...I apologize for making you read this twice!!

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •