Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
CRayF
 
Posts: n/a
Default When a cell is merely selected, executed an evaluation?

My goal is to set up a situation so that with a cell is merely
touched/selected; it adds some values for reconciliation. My example has many
complex calculations that range over rows 10-19. The cell I want to have
selected in at Q10. However, I want to replicate rows 10-19 many times
(20-29, 30-39, etc€¦)

I first though using a checkbox at Q10 would be the best solution. A
simplified example of the code looked like this: =IF(Q10,B18=E18) and when
the checkbox was selected then Q10 evaluated TRUE. But when I replicate the
rows, the checkbook does not replicate correctly.

It copies the checkbox with the €śControl Cell Link€ť for Q10 (owned by rows
10-19), rather than a separate checkbox assigned to Q20 (owned by rows
20-29), Q30 (owned by rows 30-39), etc.

Is there a way that I can merely test for Q10 being selected. And if this is
done, then evaluate B18=E18 without using a checkbox? And would allow
replicating the rows? And if not, is there a way to do this with a checkbox
without the problem above?
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

You can use the worksheet selectionchange event for that


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$Q$10" Then
'do your stuff
End If
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob Phillips

"CRayF" wrote in message
...
My goal is to set up a situation so that with a cell is merely
touched/selected; it adds some values for reconciliation. My example has

many
complex calculations that range over rows 10-19. The cell I want to have
selected in at Q10. However, I want to replicate rows 10-19 many times
(20-29, 30-39, etc.)

I first though using a checkbox at Q10 would be the best solution. A
simplified example of the code looked like this: =IF(Q10,B18=E18) and when
the checkbox was selected then Q10 evaluated TRUE. But when I replicate

the
rows, the checkbook does not replicate correctly.

It copies the checkbox with the "Control Cell Link" for Q10 (owned by rows
10-19), rather than a separate checkbox assigned to Q20 (owned by rows
20-29), Q30 (owned by rows 30-39), etc.

Is there a way that I can merely test for Q10 being selected. And if this

is
done, then evaluate B18=E18 without using a checkbox? And would allow
replicating the rows? And if not, is there a way to do this with a

checkbox
without the problem above?



  #3   Report Post  
CRayF
 
Posts: n/a
Default

Is there a way to code this so I toggle this.
If Q10 is selected again it will toggle P10 back to FALSE?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$Q$10" Then
Range("P10").Value = "TRUE"
End If
End Sub
  #4   Report Post  
Don Guillett
 
Posts: n/a
Default

try

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$10" Then
If UCase(Range("B10")) = "TRUE" Then
Range("B10") = "FALSE"
Else
Range("B10") = "TRUE"
End If
End If
Cancel = True
End Sub

--
Don Guillett
SalesAid Software

"CRayF" wrote in message
...
Is there a way to code this so I toggle this.
If Q10 is selected again it will toggle P10 back to FALSE?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$Q$10" Then
Range("P10").Value = "TRUE"
End If
End Sub



  #5   Report Post  
Bob Phillips
 
Posts: n/a
Default

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$Q$10" Then
Range("P10").Value = Not Range("P10").Value
End If
End Sub

--
HTH

Bob Phillips

"Don Guillett" wrote in message
...
try

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$10" Then
If UCase(Range("B10")) = "TRUE" Then
Range("B10") = "FALSE"
Else
Range("B10") = "TRUE"
End If
End If
Cancel = True
End Sub

--
Don Guillett
SalesAid Software

"CRayF" wrote in message
...
Is there a way to code this so I toggle this.
If Q10 is selected again it will toggle P10 back to FALSE?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$Q$10" Then
Range("P10").Value = "TRUE"
End If
End Sub







  #9   Report Post  
CRayF
 
Posts: n/a
Default

Thanks guys, this code works great for the initial set of rows.
Now, it doesnt cover the replication of the rows€¦
ROWS 11 trough 22 are replicated. So the next set of rows would be 23
through 34 (in increments of €ś12€ť.

Now, Im not familiar with the code syntax (as I am with REXX) and am
wondering if there is a way I can set the code below into a loop.

So I would need to execute the same instructions below in the €śPrivate Sub€ť
for the multiples of 12€¦
Target.Address = "$Q$12" and Range("R11") (BTW€¦ A13 is a number)
Target.Address = "$Q$24" and Range("R23") (A25 is a number)
Target.Address = "$Q$36" and Range("R35") (A37 is a number)
Etc€¦
AND the loop could end when the multiple of A13 €śISNUMBER€ť is tested FALSE.

Would this be fairly easy to code instead of me manually replicating the
code in the module?
-------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Address = "$Q$12" Then
If UCase(Range("R11")) = "TRUE" Then
Range("R11") = "FALSE"
Else
Range("R11") = "TRUE"
End If
End If

Cancel = True
End Sub
-------------------------
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
copying cell names Al Excel Discussion (Misc queries) 12 August 11th 05 03:01 PM
displaying a comment only when the cell is selected Jeff Excel Discussion (Misc queries) 1 July 6th 05 08:18 AM
cell color index comparison MINAL ZUNKE New Users to Excel 1 June 30th 05 07:11 AM
selected cell - top left Ciara Excel Discussion (Misc queries) 1 May 25th 05 12:16 PM
Can macros output to a cell selected prior to running it? winnie Excel Worksheet Functions 3 February 17th 05 11:03 PM


All times are GMT +1. The time now is 03:06 AM.

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

About Us

"It's about Microsoft Excel"