Jasen79
New Member
- Joined
- Nov 25, 2020
- Messages
- 47
- Office Version
- 365
- Platform
- Windows
- MacOS
Sub Captialcode()
' Declare Current as a worksheet object variable.
Dim Current As Worksheet
' Loop through all of the worksheets in the active workbook.
For Each Current In Worksheets
' Insert code here.
Dim rng As Range
For Each rng In ActiveSheet.UsedRange
rng.Value = UCase(rng.Value)
Next rng
' This line displays the worksheet name in a message box.
MsgBox Current.Name
Next
End Sub
I am trying to run the code through the whole workbook. I know the Upper case code works, I know the loop code works, each on their own. But together it would not. Any thoughts or insight you could provide.
' Declare Current as a worksheet object variable.
Dim Current As Worksheet
' Loop through all of the worksheets in the active workbook.
For Each Current In Worksheets
' Insert code here.
Dim rng As Range
For Each rng In ActiveSheet.UsedRange
rng.Value = UCase(rng.Value)
Next rng
' This line displays the worksheet name in a message box.
MsgBox Current.Name
Next
End Sub
I am trying to run the code through the whole workbook. I know the Upper case code works, I know the loop code works, each on their own. But together it would not. Any thoughts or insight you could provide.