Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Locking Visual Basic Cell References
Here is the problem...Please help...
I wote a Visual Basic (VB) progam that calculates a flow value and places it in a certain cell in excel...lets call this cell B2 The cell to the left of B2 is A2. A2 contains a descriptor of what is in B2 see below A B 1 2 pipe 1 256 (256 is the value that VB caculated) lets say I want to delete row 1. My worksheet now look like this... A B 1 pipe 1 256 I now clear the value in cell B1 and my workshet looks like this... A B 1 pipe 1 if i re-run the program I get the following... A B 1 pipe 256 Note that Visual Basic continues to place the calculated value in B2 . How do I "lock" the VB cell reference on the desired cell lcation? The desired cell location is now B1. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Locking Visual Basic Cell References
Felicia
there is no link between the VB code and the cell reference. So, if you delete a row in Excel, the code does not adjust itself ... it will still refer to cell B2. You will need to give the cell a reference name in Excel, for example, ValueCell. Then, in your code you can use something like Range("ValueCell").Value = 256. Regards Trevor "Felicia" wrote in message ... Here is the problem...Please help... I wote a Visual Basic (VB) progam that calculates a flow value and places it in a certain cell in excel...lets call this cell B2 The cell to the left of B2 is A2. A2 contains a descriptor of what is in B2 see below A B 1 2 pipe 1 256 (256 is the value that VB caculated) lets say I want to delete row 1. My worksheet now look like this... A B 1 pipe 1 256 I now clear the value in cell B1 and my workshet looks like this... A B 1 pipe 1 if i re-run the program I get the following... A B 1 pipe 256 Note that Visual Basic continues to place the calculated value in B2 . How do I "lock" the VB cell reference on the desired cell lcation? The desired cell location is now B1. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Locking Visual Basic Cell References
THANK YOU TREVOR!! that worked Beautifully!
|
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Locking Visual Basic Cell References
Felicia
you are most welcome! Regards Trevor "Felicia" wrote in message ... THANK YOU TREVOR!! that worked Beautifully! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Associating Visual Basic Code to a Cell | Excel Discussion (Misc queries) | |||
changing the visual basic in office 2003 to visual studio net | Excel Discussion (Misc queries) | |||
Macro Calling Visual Basic References | Excel Discussion (Misc queries) | |||
Visual Basic to reference value in Excel cell | Excel Programming | |||
visual basic command in a cell?? | Excel Programming |