Hi, Mad-Dog,
Sam, Chris, Emraz, Katy, Sophie, Monica, Kathrin
make up a count of 7 to me
Sub GripSheets_2()
Dim cs As Worksheet, ws As Worksheet, LR As Long, NR As Long
Const cstrLAST_COL As String = "CP"
If Not Evaluate("ISREF(Consolidate!A2)") Then _
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "Consolidate"
Set cs = Sheets("Consolidate")
cs.Range("A2:" & cstrLAST_COL & Rows.Count).ClearContents
For Each ws In Worksheets
Select Case ws.Name
Case "Sam", "Chris", "Emraz", "Katy", "Sophie", "Monica", "Kathrin"
LR = ws.Range("A" & Rows.Count).End(xlUp).Row
NR = cs.Range("A" & Rows.Count).End(xlUp).Row + 1
ws.Range("A2:" & cstrLAST_COL & LR).Copy
cs.Range("A" & NR).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Case Else
'do nothing here
End Select
Next ws
With cs
.Range("A1").Select
With .ListObjects.Add(xlSrcRange, .Range("A1").CurrentRegion, , xlYes)
.Name = "Table1"
.TableStyle = "TableStyleMedium9"
End With
End With
End Sub
The constant isnīt as dynamic as you may want it to be - I would need if the headings for the data wioll always be in the same row in order to check out the last used column via
lngLC = Cells(1, Columns.Count).End(xlToLeft).Column
Ciao,
Holger
Bookmarks