View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen[_2_] Per Jessen[_2_] is offline
external usenet poster
 
Posts: 703
Default define range using col and row names; not cell name

Look at this:

FirstCol=mySheet.Range("first_data_Col").Column
LastCol=mySheet.Range("last_data_Col").Column
FirstRow=mySheet.Range("first_data_row").Row
LastRow=mySheet.Range("last_data_row").row

With MySheet
set FilterRange= _
.range(.cells(FirstRow,FirstColumn),.cells(LastRow ,LastColumn))
End with

Regards,
Per

On 27 Feb., 16:53, cate wrote:
How do you set a range using these four names? They define whole rows
and columns. *The first column and row, along with the last column and
row, define a range

first_data_col
last_data_col
first_data_row
last_data_row

I can select columns with, as an example:
* * mySheet.Range(mySheet.Range("first_data_col"),
mySheet.Range("last_data_col")).EntireColumn.Hidde n = False

I'm trying to do a sort, but I have to define the range to sort, as
in * * ws.Range("D7:L25"), but I don't have cell names, I have 4 whole
row and column names ( such as $K:$K, and $4:$4)

I could disassemble these names and build a range with Cell, but isn't
there a better way?
I know this has got to be simple, but I just can’t seem to make it
work.

Thank you.