OzGrid

How to use VBA to Find tab with date

< Back to Search results

 Category: [Excel]  Demo Available 

How to use VBA to find tab with specific date

 

Requirement:

 

The user has a daily to do sheet that is reset every month that has tabs in it with the days of the month in the format "Fri 07 Jul 2017" for example. What the user wishes to do is create a block of buttons numbered 1 to 31 and assign a macro to each button that will search for the "07" bit of the example given above so that the user can select that particular sheet for that day. The user has found a way to do this via the day name such as "Fri" but can't seem to get it to work to just look up the day number ("07" in the example given).

Code:
Sub AAASearchTab()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
    If ws.Name Like "Fri*" Then
        ws.Select
        Exit For
    End If
Next ws
End Sub

 

https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/149107-find-tab-with-date

 

Solution:

 

Obtained from the OzGrid Help Forum.

Solution provided by Carim.

 

See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets

 

See also:

How to transfer and combine data from one sheet to another
How to use VBA code to extract rows of data meeting criteria
How to copy selected data and paste to the last row of another sheet
How to copy cell data to another sheet and save it automatically

 

Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.

 

 


Gallery



stars (0 Reviews)