ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   keep on adding (https://www.excelbanter.com/excel-programming/389313-keep-adding.html)

Robert[_33_]

keep on adding
 
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.


Dave Peterson

keep on adding
 
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?????

Robert wrote:

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.


--

Dave Peterson


All times are GMT +1. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com