Update Values as soon as a Worksheet becomes active?
Hi CRayF,
I then made an entry in cell C2 on Sheet1 (say "EUREKA").
Returning to Sheet2, cell C4 recorded "EUREKA
Should have read:
I then made an entry in cell C4 on Sheet1 (say "EUREKA").
Returning to Sheet2, cell C2 recorded "EUREKA
(I inadvertently inverted the C2, C4 cell references!)
---
Regards,
Norman
"Norman Jones" wrote in message
...
Hi CRayF,
That didn't work
I pasted the following into Sheet2's code module in a new workbook
'===============
Private Sub Worksheet_Activate()
If Not ActiveSheet.Previous Is Nothing Then
Me.Range("C2").Value = Me.Previous.Range("C4").Value
End If
End Sub
.<<===============
I then made an entry in cell C2 on Sheet1 (say "EUREKA").
Returning to Sheet2, cell C4 recorded "EUREKA"
So, for me at least, it did work.
---
Regards,
Norman
"CRayF" wrote in message
...
That didn't work.
I tried adding it to the top of the Module...
I then tried adding
Private Sub Worksheet_Activate(ByVal Target As Range)
That didn't work either.
And where do I put it?
Private Sub Worksheet_Activate()
'------------------------------------------------------------------------
' [ C2 ] Pull Previous Race Account Balance if available
' *Note This is being populates at startup
'------------------------------------------------------------------------
If Not ActiveSheet.Previous Is Nothing Then
Range("C2").Value = ActiveSheet.Previous.Range("C4").Value
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'------- Main File Names used for this WorkBOOK ---------------
'--*** Use Program Input Worksheet as a Master for changes ***
'--------------------------------------------------------------
Dim srcProgramDataInputWs As Worksheet
...
...more code...
...
"Norman Jones" wrote:
Hi CRayF,
Try the Worksheet_Activate() event.
---
Regards,
Norman
"CRayF" wrote in message
...
I noticed that when I start the Worksheet, the following action is at
the
top
of my module and does not execute until I click on something on the
Worksheet. In my Worksheet Module I have one SUB().
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not ActiveSheet.Previous Is Nothing Then
Range("A1").Value = ActiveSheet.Previous.Range("A1").Value
End If
.more code...
I suspect that by the name of the Sub evens are monitored only when an
event
is activated.
Now, how do I code a sub() to execute as soon as the Worksheet becomes
active? And where do I put it?
|