keep on adding

R

Robert

my problem is the following.

Since I have a numerical integration method implemted in my excel
sheet I have a huge amount of rows containing data which I can find
the value I need with vertical lookup. However, I would like to give
it a go with VBA.

I want to work with little steps, which keeps on adding up "tt" till
the desired value.

tt = Range("A35")
dt = Range("B38")
xt = Range("35B")

If xt = xt Then tt = tt + dt

I tried the above. but he only does it once, and i want it to keep on
going. I´ve searched the web and hit help function. I guess I have to
use the Do..Loop function. Anyone who knows how to fix this.

It is cell A35 which have to ascent.
 
D

Dave Peterson

I don't understand a few things--like range("35B") or what you're doing, but you
can use =vlookup() in your code:

Dim res as variant 'could return an error -- #n/a in a worksheet
dim TableRng as range
dim myVal as variant

with worksheets("sheet999")
set tablerng = .range("a1:x" & .cells(.rows.count,"A").end(xlup).row)
end with

myVal = "whatever you're matching on"

res = application.vlookup(myval, tablerng, 3, false)

if iserror(res) then
'not found
else
msgbox res
end if

Maybe it'll help?????
 

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

Top