View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default Deleting Columns - Causes Code Changes

another idea is using something **in** the column itself to set the
range. like say the column you want the named range to be in always
contains the word "small" somewhere in the column. set the range by
using FIND; then no matter if "small" is found in Column C or in
Column F, it will be correct.
susan



On Dec 11, 3:13 pm, "
wrote:
On Dec 11, 1:29 pm, " wrote:

1. Range("C" & nRow).Select - If I wanted to use a named range to
refer to column C do I define it as "Master!$C:$C"? Because in this
case i want to refer to a specific row in that column.


I think I see where you're going, but using a named range to fix the
problem with deleting columns isn't going to work. If you delete a
column, you also delete it's name if you've named the column as a
range. But, either way, to answer this #1...

Range("MyNamedRangesName").Row(nRow).Select

2. How do I use my named range when using the Autofilter?
Selection.AutoFilter Field:=20 since it takes a coumn number not a
Column letter.


Dim nColumn, r as Range

Set r = Range("MyNamedRangesName")
nColumn = r.Column
r.AutoFilter Field:=nColumn, Criteria1:="YourCriteria"

3. Same issue with using offset, it takes a column number not letter,
so how can i use a named range in the offset call?


This doesn't make much sense without knowing what you're trying to do,
but you can see in #2's answer how to get a column number from the
named range.

Hope something in that helps..
Cory