03856me
Active Member
- Joined
- Apr 4, 2008
- Messages
- 297
Help with ws.Name = I am creating a summary page that will clear and refresh each time a new worksheet is added by the user. On the Summary page I want to pull the ws.Name into column A. This code is working except it is pulling the summary page worksheet name of "TOTALS". Here is a snippet of what I want the TOTALS page to look like as well as my existing code. Thank you for helping.
VBA Code:
Sub MakeSummaryTable()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim wb As Workbook: Set wb = ThisWorkbook
Dim ws As Worksheet
Set ws = wb.Sheets("TOTALS")
ClearData_TOTALS
For Each ws In Worksheets
If ws.Name <> "Master" And ws.Name <> "Summary" And ws.Name <> "Recap" And ws.Name <> "TEXT" Then
Range("A100").End(xlUp).Offset(1, 0).Value = ActiveSheet.Name 'worksheet #
Range("B100").End(xlUp).Offset(1, 0).Value = ws.Range("L39").Value 'Total Today - LBS/SY
End If
Next ws
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
'======================================================================================
Sub ClearData_TOTALS()
Range("A4:C100").Select
Selection.ClearContents
End Sub