I haven't been able to find a code to name a range in each worksheet with the name of the worksheet. Would this be possible? I have the below so far. Am I heading in the right direction? Do I need to do something else?
Sub Add_ALL_Budgets()
Dim Awb As Workbook
Dim ws As Worksheet
Set Awb = ThisWorkbook
For Each ws In Awb.Worksheets
If UCase(Right(Trim(ws.Name), 6)) = "BUDGET" And _
UCase(Left(Trim(ws.Name), 3)) <> "158" Then
ws.Activate
Range("T1").Select
Selection.Value = "WORKS!" 'this was to check it selected the worksheets I wanted
Range("T8:AE215").Name = ' What do I do here?
ElseIf UCase(Right(Trim(ws.Name), 6)) = "BUDGET" And _
UCase(Left(Trim(ws.Name), 3)) = "158" Then
ws.Activate
Range("T1").Select
Selection.Value = "WORKS!"
Range("Z8:AK215").Name = UCase(ws.Name) 'This doesn't work
End If
Awb.Activate
Next ws
End Sub
Sub Add_ALL_Budgets()
Dim Awb As Workbook
Dim ws As Worksheet
Set Awb = ThisWorkbook
For Each ws In Awb.Worksheets
If UCase(Right(Trim(ws.Name), 6)) = "BUDGET" And _
UCase(Left(Trim(ws.Name), 3)) <> "158" Then
ws.Activate
Range("T1").Select
Selection.Value = "WORKS!" 'this was to check it selected the worksheets I wanted
Range("T8:AE215").Name = ' What do I do here?
ElseIf UCase(Right(Trim(ws.Name), 6)) = "BUDGET" And _
UCase(Left(Trim(ws.Name), 3)) = "158" Then
ws.Activate
Range("T1").Select
Selection.Value = "WORKS!"
Range("Z8:AK215").Name = UCase(ws.Name) 'This doesn't work
End If
Awb.Activate
Next ws
End Sub