Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Assigning a variable a value from a Cell in VBA
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Assigning a variable a value from a Cell in VBA
Thanks for the reply Dave,
I tried the command you gave me and I get the following error when running. Run-time error '438': Object doesn't support this property or method. I think that Package is the object correct. Just as an fyi I'm using Excel 2000 and VBA 6.0. Any other ideas? Thanks, Jeff |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Assigning a variable a value from a Cell in VBA
I think you're going to have to post the code you used--include the DIM
statements, too. " wrote: Thanks for the reply Dave, I tried the command you gave me and I get the following error when running. Run-time error '438': Object doesn't support this property or method. I think that Package is the object correct. Just as an fyi I'm using Excel 2000 and VBA 6.0. Any other ideas? Thanks, Jeff -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Assigning values to a variable set | Excel Discussion (Misc queries) | |||
Assigning a variable | Excel Worksheet Functions | |||
Assigning a row to a variable | Excel Programming | |||
assigning worksheet variable | Excel Programming | |||
Re-assigning the value of a variable for a for loop from | Excel Programming |