C
CellShocked
What the heck. It did not do this before.
Now, whenever I run this code, this error pops up, then I click OK (the
only option), and then the data fills in correctly. It did not do this
before.
I have the actor index data and actor data on two other sheets, as well
as table1 and table 2, and table 4 is on the Master_Pane sheet (sheet1),
from which I do a simple vlookup to get the actor names to pop in based
on the id numbers that fill table 4 in.
Here is a screen shot as well...
http://i255.photobucket.com/albums/hh143/WallyWallWhackr/ScreenShot1.png
and the code (pops in the actor ID numbers into table 4):
Sub FilterOnVar()
Dim rngData As Range
Dim rngCriteria As Range
Dim rngExtract As Range
Dim s As String
Application.ScreenUpdating = False
With Sheets("Acted_In")
Set rngData = .Range("Table1[#All]")
Set rngCriteria = .Range("Table3[#All]")
End With
With Sheets("Master_Pane")
Set rngExtract = .Range("Table4[#Headers]")
rngData.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=rngCriteria, _
CopyToRange:=rngExtract
With .ListObjects("Table4")
If .ListColumns(1).DataBodyRange.Cells(1) <> "" Then
.Resize .HeaderRowRange.CurrentRegion
End If
End With
End With
End Sub
The error appears on the 5th line up from the bottom:
".Resize .HeaderRowRange.CurrentRegion" line.
Now, whenever I run this code, this error pops up, then I click OK (the
only option), and then the data fills in correctly. It did not do this
before.
I have the actor index data and actor data on two other sheets, as well
as table1 and table 2, and table 4 is on the Master_Pane sheet (sheet1),
from which I do a simple vlookup to get the actor names to pop in based
on the id numbers that fill table 4 in.
Here is a screen shot as well...
http://i255.photobucket.com/albums/hh143/WallyWallWhackr/ScreenShot1.png
and the code (pops in the actor ID numbers into table 4):
Sub FilterOnVar()
Dim rngData As Range
Dim rngCriteria As Range
Dim rngExtract As Range
Dim s As String
Application.ScreenUpdating = False
With Sheets("Acted_In")
Set rngData = .Range("Table1[#All]")
Set rngCriteria = .Range("Table3[#All]")
End With
With Sheets("Master_Pane")
Set rngExtract = .Range("Table4[#Headers]")
rngData.AdvancedFilter Action:=xlFilterCopy, _
CriteriaRange:=rngCriteria, _
CopyToRange:=rngExtract
With .ListObjects("Table4")
If .ListColumns(1).DataBodyRange.Cells(1) <> "" Then
.Resize .HeaderRowRange.CurrentRegion
End If
End With
End With
End Sub
The error appears on the 5th line up from the bottom:
".Resize .HeaderRowRange.CurrentRegion" line.