Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'https://www.facebook.com/groups/659225117560345/permalink/2494806137335558
- 'I have a monthly timesheet where different speadsheet for each team member.
- 'Need some help experts. e.g Jul_22_SA, Jul_22_AN (FYI: sheet name format Mmm_YY_INITIALS).
- 'Each sheet consists of 2 table ranges, one for Billable (B) activitie the other one is for Nonbillable (NB) activities
- 'Is there a way i have the table name alligned with the sheet name automaticaly like JUL22SAB and JUL22SANB.
- Sub RenameTables()
- Dim tName As String
- Dim sht As Worksheet
- 'Loop over the worksheets
- For Each sht In ThisWorkbook.Worksheets
- With sht
- ' OP states each sheet has 2 tables, billable(B) & non-billable(NB)
- ' test that the sheet has exactly 2 tables
- If .ListObjects.Count = 2 Then
- 'sheet name is in format Mmm_yy_XX
- 'table name format required MMMYYXXB/NB
- tName = UCase(Replace(.Name, "_", "")) 'Convert sheet name
- .ListObjects(1).Name = tName & "B" ' billable table
- .ListObjects(2).Name = tName & "NB" ' non-billable table
- End If
- End With
- Next sht
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement