LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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?









 
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
Update one worksheet tab to automatically update all other tabs? shoechic1 Excel Worksheet Functions 1 May 24th 09 03:55 PM
Macro to update active workbook in one folder Mike @ GD Excel Worksheet Functions 8 January 15th 09 02:19 PM
Update Macro: Leave Colour As Before Once Cell is Not Active JB2010 Excel Discussion (Misc queries) 2 February 2nd 06 06:08 PM
Chart values do not update links to new worksheet DA Charts and Charting in Excel 0 November 28th 05 08:43 PM
update row numbers after different active cells in macros followi. LMIV Excel Discussion (Misc queries) 11 February 16th 05 12:44 AM


All times are GMT +1. The time now is 07:07 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"