View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default return a cell address?

Make sure you:
Dim RngStart as Range

Then you'll get yelled at when you do this:
rngStart = c.Offset(1, 0)

you'll want:

Set rngStart = c.Offset(1, 0)

==
If you didn't declare RngStart, then excel saw that variable as a Variant.

By not using Set, it _knew_ you wanted to use the value (the default property of
that range).





green fox wrote:

I'm trying to loop through column of text for a word (SECTIONS) and
another (GROUPS). Where these are in the column varies although they
appear in that order. The two words frame a range that includes from 4
to 15 cells.

trycell = c.Value
If trycell = "SECTIONS" Then
c.Activate
rngStart = c.Offset(1, 0)

it's part of a for...next loop with a nested if. rngStart is dim'd as a
range,
but the c.Offset( 1,0) defaults to returning the value in the cell. I
need the range from that and the range from the second word to assign
it to a variable. I will be using the values from the selected range to
create an array. I haven't found anything in 'help' about returning a
cell address. Any ideas would be appreciated.

Andy


--

Dave Peterson