LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Macro question: Using named ranges



Hey guys.

I have a macro which performs lookups to list the director and actor
names in a film.

I have named ranges for the film to director name, and I have named
ranges for the film to actor(s) list. I want to use the named ranges
instead of tables, if possible. I think some of the tables are required
though.

I currently get errors related to overlapping unequal sized tables of
data. I currently use the macro to declare or create the data tables (I
think).

So, the director index grabs the director number, and the director
names list grabs the name from that number. This is easy.

The actors listing, however, is a bit more difficult because it has to
compile a list first then fill a table with it, the copy that into my
main worksheet.

I have named ranges which encompass entire columns, because the table
gets new entries placed into it all the time. I assumed that this would
solve that.

So, I have named ranges for:

The director index as: DIndex

The director names are as: Directors

The actor's listing are as: Actors

The table for the actors and film reference has been defined as a
table.
Next to that table, a table gets filled with the actors numbers that
match the film number.

That table is what I use to perform lookups into to fill my "actors
list in my main worksheet.

Here is my macro. I get the error on the line that resizes a table

..Resize .HeaderRowRange.CurrentRegion

Macro:

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





I do not know why I am getting errors. It used to work.
I get "Runtime error # 1004" (invalid range).

Is there a better way to perform these lookups, and fill a table with
the queried actor listing?
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
named ranges question Chris Excel Worksheet Functions 2 September 6th 08 01:46 PM
Named ranges scope / workbook/worksheet level named ranges- changeswith variable use... christian_spaceman Excel Programming 3 December 24th 07 01:15 PM
Named ranges - column/row question Carole O Excel Discussion (Misc queries) 5 May 11th 05 02:40 PM
named Ranges question John Excel Worksheet Functions 4 January 8th 05 01:59 AM
an easy question (to some of you, but not to me) on named ranges L. T. Portella Excel Programming 1 September 30th 03 04:05 AM


All times are GMT +1. The time now is 10:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"