I'm trying to loop through my 89 worksheets and extract some data to consolidate them. I want to skip worksheet "global" and "34". I want to get the data from column A to M except row 1. I want to get those data (that are not in tables) and put them at the same place (in my code I tried to put them in a table but its optional.
I'm getting an error 400. Any suggestions?
Sub data()
Dim ws As Worksheet
Dim count As Long
Dim x As Long
Set tblref = Sheets("Global").ListObjects("ref_global")
For Each ws In ThisWorkbook.Worksheets
If Not ws.Name = "Global" Then
If Not ws.Name = "34" Then
numrows = ws.Range("A1", ws.Range("A1").End(xlDown)).Rows.count
ws.Range("a2").Select
For x = 2 To numrows
ws.Range("cells(x,1):cells(x,14)").Select
Selection.Copy
Dim lrow As ListRow
Set lrow = tblref.ListRows.Add
With lrow
.PasteSpecial
End With
Next x
End If
End If
Next ws
End Sub