Error 400 in VB code execution?

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.
 
P

Peter T

Difficult to recreate your setup but at a glance try changing

.Resize .HeaderRowRange.CurrentRegion

to

.Resize .HeaderRowRange.CurrentRegion.rows.count, _
.HeaderRowRange.CurrentRegion.columns.count

That might not be what you want but look at Resize in help

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top