Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Update Values as soon as a Worksheet becomes active?
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Update Values as soon as a Worksheet becomes active?
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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Update Values as soon as a Worksheet becomes active?
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? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Update Values as soon as a Worksheet becomes active?
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? |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Update Values as soon as a Worksheet becomes active?
Here's what's happing. I click on a a cell that creates a new target
Worksheet built from a template. When the new target is build, this new Worksheet becomes Active. I am hoping to have the value update immediately. What is happing is that if I click off that Worksheet and return, it works fine. But it is not being populated once I am initially placed there my the earlier SUB(). "Norman Jones" wrote: 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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Update one worksheet tab to automatically update all other tabs? | Excel Worksheet Functions | |||
Macro to update active workbook in one folder | Excel Worksheet Functions | |||
Update Macro: Leave Colour As Before Once Cell is Not Active | Excel Discussion (Misc queries) | |||
Chart values do not update links to new worksheet | Charts and Charting in Excel | |||
update row numbers after different active cells in macros followi. | Excel Discussion (Misc queries) |