View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mervyn Thomas Mervyn Thomas is offline
external usenet poster
 
Posts: 44
Default What's wrong with this bit of code

Afraid that didn't work plus a few alternatives. The lookup part of the
equation works OK anyway - what is wrong is passing the variable into the
eqation and what gets put in the cell is =Vlookup(tempvar,codelookup.......)
and what I need is the value of tempvar in the equation.
Thanks for the suggestion
Mervyn

"George Nicholson" wrote in message
...
Specify 'Range("CodeLookup")' rather than just 'CodeLookup'? There may be
something else going on, but that's my initial knee-jerk reaction.

--
George Nicholson

Remove 'Junk' from return address.


"Mervyn Thomas" wrote in message
...
I am trying to change a cell to a new value derived from looking itself

up
in a list and cannot work out how to do it without using a temporary

cell
to
hold the original data and then lookup using this. I cannot see why the
following does not work!

Dim tempvar
Cells(2, 5).Select
tempvar = Cells(2, 5)
ActiveCell.FormulaR1C1 = "=VLookup(tempvar, CodeLookup, 2, True)"
'CodeLookup is a list


Can anyone help please