Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mac Mac is offline
external usenet poster
 
Posts: 213
Default Tracking cell values...?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Tracking cell values...?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Tracking cell values...?

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   Report Post  
Posted to microsoft.public.excel.programming
Mac Mac is offline
external usenet poster
 
Posts: 213
Default Tracking cell values...?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
enetering fed ex tracking # in cell EXCEL Excel Worksheet Functions 2 March 4th 08 06:42 PM
Tracking values from different sheets Rao Ratan Singh Excel Discussion (Misc queries) 2 December 11th 06 11:00 AM
Tracking values from different sheets. Rao Ratan Singh Excel Discussion (Misc queries) 0 December 2nd 06 11:16 AM
I want cell name vs cell reference in history tracking Lisa Excel Discussion (Misc queries) 0 July 18th 06 03:58 PM
How to insert tracking numbers into my webpage for RMA tracking wiglady Excel Discussion (Misc queries) 0 April 4th 06 12:44 PM


All times are GMT +1. The time now is 01:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"