View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Assigning a variable a value from a Cell in VBA

Dim pack as variant

pack = worksheets("package").range("B4").value
or
pack = worksheets("package").cells(4,2).value



wrote:

I'm having a little difficulty assigning a variable the value of a cell
in a different worksheet. I hope that makes sense. Here is what I'm
trying to accomplish.

pack = "=Package!R[4]C[2]"

I want the value that is in the cell referenced to be stored in the
variable pack. Whenever I run this it stores "=Package!R[4]C[2]" as
what is in pack. I'm new to writing Macro's in VBA so if this seems
trivial please forgive me.

Thanks,
Jeff


--

Dave Peterson