Question about cell adressing

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

Folks,

I found a way to speed up my macro to select my data range by just
locating the first cell and then using count to count the used cells...

Now what I have is:
D
1 $D$17 (which is the start address)
2 623 (which is the amount of used cells)


So my data range is from $D$17 to $D$640.

Now I need to add 623 to the $D$17 in cell D2.

The formula would look like that Cell(D3)=($D$[a+b]).

Where a=17 (from $D$17)
b=623 (the value from D2!).


How does it need to be coded so that excel puts

$D$640 (doesnt need the $) in lets say, D3?

Thanks :)

Matt
 
with activesheet
.range("d3").value _
= .range(.range("d1").value).offset(.range("d2").value).address(0,0)
end with


but I think you have a difference of 1 in your count. D17:D640 is really 624
cells.

if you care...

with activesheet
.range("d3").value _
= .range(.range("d1").value).offset(.range("d2").value-1).address(0,0)
end with
Folks,

I found a way to speed up my macro to select my data range by just
locating the first cell and then using count to count the used cells...

Now what I have is:
D
1 $D$17 (which is the start address)
2 623 (which is the amount of used cells)

So my data range is from $D$17 to $D$640.

Now I need to add 623 to the $D$17 in cell D2.

The formula would look like that Cell(D3)=($D$[a+b]).

Where a=17 (from $D$17)
b=623 (the value from D2!).

How does it need to be coded so that excel puts

$D$640 (doesnt need the $) in lets say, D3?

Thanks :)

Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top