View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default Use cell content as range address reference/count?

MsgBox Range(Sheets("Sheet2").Range("A1").Value).Cells.Co unt

This returns 241 ... haven't checked if that's right

Regards

Trevor


"tskogstrom" wrote in message
oups.com...
Hi,

I store the address of rows with a code like:
Sheet2.Range("A1").Value =
Columns("V:V").SpecialCells(xlCellTypeFormulas, 1).Rows.Address.

In cell A1 the content could look like:
$V$10:$V$25,$V$33:$V$48,$V$54:$V$71,$V$77:$V$94,$V $100:$V$117,$V$124:$V
$140,$V$147:$V$163,$V$165:$V$233,$V$238:$V$289

I use to check if there has been any changes in the sheet since last
time visited by this code, buy a check in Worksheet_Activate event
like:
IF Columns("V:V").SpecialCells(xlCellTypeFormulas, 1).Rows.Address <
Sheet2.Range("A1").value THEN ..., but that doesn't matter now. That
work ok. THE NEED NOW, is to know how many rows the address consist
of.

I thought I just could write like:
Debug.print Range(Sheet2.Range("A1").Value).Cells.Count

But I get error. What's wrong?

Kind regards
Tskogstrom