Hello
I'm using Excel 2010.
I have a macro in my workbook that copies the contents of some of the worksheets into a single worksheet called Master_NewA. With the way the code is written right now, it will keep adding the same worksheets after each other so I want to include code to see if there is data so it will delete first and then run the code and if not then just run the code.
The current code is:
Thanks very much.
I'm using Excel 2010.
I have a macro in my workbook that copies the contents of some of the worksheets into a single worksheet called Master_NewA. With the way the code is written right now, it will keep adding the same worksheets after each other so I want to include code to see if there is data so it will delete first and then run the code and if not then just run the code.
The current code is:
Code:
Sub Consolidate_NewA()
'this assumes
' Master sheet for combining data from all other sheets
' HEADINGS in Master in Row 1 starting in column A
' Mapping sheet with NAMED RANGES courtesy Skip_TekTips
' Source & MasterCOL
Dim ws As Worksheet, r As Range, wsMSTR As Worksheet, lRow As Long
For Each ws In Worksheets
With ws
Select Case .Name
Case "Master_NewA", "Mapping_NewA", "RawData_A", "RawDataA_Map", _
"Values", "Template", "ReadMe_Reabstractors", "ReadMe_Clients", _
"Rat_Val"
Case Else
lRow = wsMSTR.[A1].CurrentRegion.Rows.Count + 1
For Each r In [SourceNewA]
wsMSTR.Cells(lRow, r.Offset(0, 2).Value) = .Range(r.Value)
Next
End Select
End With
Next
End Sub
Thanks very much.