New & Less Than You Think: List Managers | | Excel Charting Lessons.
Working With Excel Sheets In VBA: You'll get all the below codes, plus more. All code is ready to use, unless stated otherwise. Below is some examples on non ready code. All code has liberal comments so you can understand the examples.
'''''''''''''''''''''''''''
''WORKING WITH WORKSHEETS''
'''''''''''''''''''''''''''
Sub SelectedWoksheets()
'http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm
Dim ws As Worksheet
For Each ws In ActiveWindow.SelectedSheets
With ws
'With Code Here
End With
Next ws
End Sub
Sub WoksheetsByCodeName()
'http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm
Dim ws As Worksheet
For Each ws In Worksheets
'Select case is case sensitive
Select Case UCase(ws.CodeName)
'http://www.ozgrid.com/VBA/select-case.htm
Case "SHEET1", "SHEET3", "SHEET5" 'ect
With ws
'With Code Here
End With
'Optional use when most sheets are to be used
'In this case, use "Case" to name sheets to be NOT used
Case Else
With ws
'With Code Here
End With
End Select
Next ws
End Sub
Sub WoksheetsByName()
Dim ws As Worksheet
'http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm
For Each ws In Worksheets
'Select case is case sensitive
'http://www.ozgrid.com/VBA/select-case.htm
Select Case UCase(ws.Name)
Case "SHEET1", "SHEET3", "SHEET5" 'ect
With ws
'With Code Here
End With
'Optional use when most sheets are to be used
'In this case, use "Case" to name sheets to be NOT used
Case Else
With ws
'With Code Here
End With
End Select
Next ws
End Sub
Sub WoksheetsByNamingConvention()
Dim ws As Worksheet
'http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm
For Each ws In Worksheets
If ws.Name Like "Data*" Then
With ws
'With Code Here
End With
End If
Next ws
End Sub
Excel Dashboard Reports & Excel Dashboard Charts 50% Off Become an ExcelUser Affiliate & Earn Money
Special! Free Choice of Complete Excel Training Course OR Excel Add-ins Collection on all purchases totaling over $64.00. ALL purchases totaling over $150.00 gets you BOTH! Purchases MUST be made via this site. Send payment proof to special@ozgrid.com 31 days after purchase date.
Instant Download and Money Back Guarantee on Most Software
Excel Trader Package Technical Analysis in Excel With $139.00 of FREE software!
Microsoft ® and Microsoft Excel ® are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft
GIVE YOURSELF OR YOUR COMPANY 24/7 MICROSOFT EXCEL SUPPORT & QUESTIONS