Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need cells linked together based on their values.
I've made up the following scenario: select a cell (e.g. C4); invoke a macro which decremets the value in C4 by one; another cell (e.g. A2) is somehow 'linked' to C4 and so is decremented by one as well; that's it. My requests a 1. Could someone please hint me to the code to do this (I'm thinking in C and assembly, which is unfortunate for this task of course) 2. I'll have more of such links throughout my worksheet, so the perfect solution would be to store each cell's link to its 'custom property' so that the macro code would only read the cell clicked and from its properties see what other cells should be afected; hope I'm making myself clear... Is this possible somehow? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
All you have to do is put in the link cell =C4. You can manuals do theis on
the worksheet or do it by VBA Range("A1") = "=C4" or Range("A1").formula = "=C4" I don't see any difference with C Language, Basic, or Assembly Language. I have over 25 years of writing code in all three languagges plus Fortran and Pascal. I have writen assembly language proably in 10 diffferent assembly languages. "Mac" wrote: I need cells linked together based on their values. I've made up the following scenario: select a cell (e.g. C4); invoke a macro which decremets the value in C4 by one; another cell (e.g. A2) is somehow 'linked' to C4 and so is decremented by one as well; that's it. My requests a 1. Could someone please hint me to the code to do this (I'm thinking in C and assembly, which is unfortunate for this task of course) 2. I'll have more of such links throughout my worksheet, so the perfect solution would be to store each cell's link to its 'custom property' so that the macro code would only read the cell clicked and from its properties see what other cells should be afected; hope I'm making myself clear... Is this possible somehow? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Further to other answers to reduce the value of a cell by 1 whenever it is
selected try this. Right click the shet tab, view code and paste in Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub If Not Intersect(Target, Range("A1,B1,C1")) Is Nothing Then 'Change to suit If IsNumeric(Target) Then Application.EnableEvents = False Target = Target - 1 Application.EnableEvents = True End If End If End Sub Mike "Mac" wrote: I need cells linked together based on their values. I've made up the following scenario: select a cell (e.g. C4); invoke a macro which decremets the value in C4 by one; another cell (e.g. A2) is somehow 'linked' to C4 and so is decremented by one as well; that's it. My requests a 1. Could someone please hint me to the code to do this (I'm thinking in C and assembly, which is unfortunate for this task of course) 2. I'll have more of such links throughout my worksheet, so the perfect solution would be to store each cell's link to its 'custom property' so that the macro code would only read the cell clicked and from its properties see what other cells should be afected; hope I'm making myself clear... Is this possible somehow? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Gretát, thanks! It is not working yet, though, but I guess it's my fault in
putting the code into the worksheet... How about the second part of my request - can you think of a way to put the 'linked cells' info somewhere into a cell (as a string, perhaps)? Is there something like a custom property of a cell that could be used for this? "Mike H" wrote: Further to other answers to reduce the value of a cell by 1 whenever it is selected try this. Right click the shet tab, view code and paste in Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub If Not Intersect(Target, Range("A1,B1,C1")) Is Nothing Then 'Change to suit If IsNumeric(Target) Then Application.EnableEvents = False Target = Target - 1 Application.EnableEvents = True End If End If End Sub Mike "Mac" wrote: I need cells linked together based on their values. I've made up the following scenario: select a cell (e.g. C4); invoke a macro which decremets the value in C4 by one; another cell (e.g. A2) is somehow 'linked' to C4 and so is decremented by one as well; that's it. My requests a 1. Could someone please hint me to the code to do this (I'm thinking in C and assembly, which is unfortunate for this task of course) 2. I'll have more of such links throughout my worksheet, so the perfect solution would be to store each cell's link to its 'custom property' so that the macro code would only read the cell clicked and from its properties see what other cells should be afected; hope I'm making myself clear... Is this possible somehow? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
enetering fed ex tracking # in cell | Excel Worksheet Functions | |||
Tracking values from different sheets | Excel Discussion (Misc queries) | |||
Tracking values from different sheets. | Excel Discussion (Misc queries) | |||
I want cell name vs cell reference in history tracking | Excel Discussion (Misc queries) | |||
How to insert tracking numbers into my webpage for RMA tracking | Excel Discussion (Misc queries) |