Activating Open Workbook and Sheet using multiple Wildcards

vmschmidt

New Member
Joined
Jul 15, 2016
Messages
1
Hello all. Complete somewhat self-taught newbie here (so sorry in advance).

I have a macro that gives the user an option to copy data from EITHER a workbook (already) run once in the morning titled "YY-MM-DD BBC_Dispatch1.xlsx" opened from a folder, -OR- copy the report from a just-run workbook (if they wanted updated data in the afternoon) reporting live data titled "BBC_Dispatch1.xlsx". Either one of these workbooks will be open when the macro is run, NEITHER of them will be open at the same time.

In addition, I want to negate an issue where, when the live report is run for the first time, it is called "BBC_Dispatch1" however if run multiple times, the title changes from Dispatch1 to 2 or 3 (that is another macro I have no control over). So one of these reports could be titled "BBC_Dispatch4.xlsx".

The tab I want activated on both is called "tblDispatch", both Sheet3.

I have the code to activate JUST the "BBC_Dispatch1.xlsx" workbook and tab and it works just fine, but I want it to be easier on the user to pull from either source. Is there a way to Activate either worksheet (remember they will NOT be open at the same time) using multiple wildcards similar to what they would both have in common: "*BC_Dispatch*.xlsx", where the first * could be the date and the first B in one workbook, or just the first B in the other workbook; the second wildcard would represent the 1, 2, 3, etc? And then also activate the "tblDispatch" tab?

I just need to Activate, I have the rest of the copy/paste/formatting/pivot part working.
Thank you,
v.
 

Forum statistics

Threads
1,081,617
Messages
5,360,044
Members
400,565
Latest member
Tommy O

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top