View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Jonsson Jonsson is offline
external usenet poster
 
Posts: 45
Default VBA instead of lookupformula

Hi Don!

Sorry, but I can't make it work!

When I paste the code you gave me, into the sheets VBA, as I assume I should
do, I get a errormessage that says:
"undifined variable" at "mrng". I'm not so good at VBA, so I hope you have
patiens with me.
I use the swedish version, maybe thats the problem?

//Thomas


"Don Guillett" skrev i meddelandet
...
just use the example I gave you, modified to suit
OR modify this idea to suit. Formula is created,copied down,changed to

value

Sub balance()
Set mrng = Range("h8:h" & Range("a65536").End(xlUp).Row)
With mrng
Formula="=IF(A$21=0;"";IF(B6<A$21;"";LOOKUP(A$21; B6;C6)))"
' .Formula = "=h7+d8"
.Formula = .Value
End With
End Sub


--
Don Guillett
SalesAid Software

"Jonsson" wrote in message
...
Hi Don!

Could you please help me understand by convert this formula into VBA:
=IF(A$21=0;"";IF(B6<A$21;"";LOOKUP(A$21;B6;C6)))

Thanks in advance

//Thomas



"Don Guillett" skrev i meddelandet
...
Should help. Just reference the range in the vba or use find & offset
range("a4")=application.vlookup(range("a1"),range( "b2:x100"),2,false)

--
Don Guillett
SalesAid Software

"Jonsson" wrote in message
...
Hi,

Is it possible to do lookup in VBA instead of a formula?

I have a workbook with a huge amount of lookupformulas and therefore

the
size of the workbook is so big that it gets unstabile.

If I write in code, will the size decrease?
If so, can anyone give me a little help in how to do that?

Any help is appreciated!

//Thomas