Changing date in excel tab hampering my macro. Can i use partial name?

nbiancardo

New Member
Joined
Sep 1, 2011
Messages
3
My macro opens a file and copies several tabs of data into another file. The problem is that there are dates associated with each tab that change daily. So Monday the tab is”VA1 30Aug11” and Tuesday it would be VA1 1Sep11”. Is there any way for the macro just to look for the “VA1” portion of the tab and ignore the rest? Their are 50 different tabs VA1, VA2, etc so changing their names would be too time consuming.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p> </o:p>
<o:p> </o:p>
Many thanks,<o:p></o:p>
<o:p> </o:p>
Nick<o:p></o:p>
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Welcome to MrExcel.

Maybe:

Code:
Dim ws as Worksheet
For Each ws in ActiveWorkbook.Worksheets
    If Left(ws.Name, 3) = "VA1" Then
'        Som code if True
    End If
Next ws
 
Upvote 0
Forgive me if this seems obvious as I use macros alot, but without any real knowledge of it......just kind of trial and error.

The following is a portion of the macro i'm concerned with. I'm looking to have it read only the "T VA12 A" portion of the sheet name so that the following day when the name has changed to "T VA12 A 31Aug11" the macro will run without issue.....if you already answered that and I'm too computer illiterate to know it, well then I apologies!<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>

Sheets("VA2").Select
Windows("IVA Trials.xls").Activate
Sheets("T VA12 A 30Aug11").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy
Windows("Dailyflows.xlsm").Activate
Cells.Select
ActiveSheet.Paste
 
Upvote 0
Try replacing this:

Code:
Sheets("T VA12 A 30Aug11").Select
Cells.Select
Application.CutCopyMode = False
Selection.Copy

with:

Code:
Dim ws as Worksheet
For Each ws in ActiveWorkbook.Worksheets
    If Left(ws.Name, 8) = "T VA12 A" Then
        ws.Cells.Copy
        Exit For
    End If
Next ws
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,267
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top