ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sheet event wait for another event? (https://www.excelbanter.com/excel-programming/449854-sheet-event-wait-another-event.html)

[email protected]

sheet event wait for another event?
 
I have an "in local workbook" hyperlink on sheet "employee roster". The roster's hyperlink event fires when a selection is made. It writes a cell value on the hyperlink's destination sheet, "employee report"

In the employee report sheet activate event I read that value written by the
roster's hyperlink event. Problem is activate event goes first.

Is there a way to sleep the activate event, and wait for the hyperlink event to finish?

[email protected]

sheet event wait for another event?
 

Is there a way to sleep the activate event, and wait for the hyperlink event to finish?


I tried this and .. no go

Dim newHour As Variant: newHour = Hour(Now())
Dim newMinute As Variant: newMinute = Minute(Now())
Dim newSecond As Variant: newSecond = Second(Now()) + 5
Dim waitTime As Variant: waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime


GS[_2_]

sheet event wait for another event?
 
I have an "in local workbook" hyperlink on sheet "employee roster".
The roster's hyperlink event fires when a selection is made. It
writes a cell value on the hyperlink's destination sheet, "employee
report"

In the employee report sheet activate event I read that value written
by the roster's hyperlink event. Problem is activate event goes
first.

Is there a way to sleep the activate event, and wait for the
hyperlink event to finish?


Why do you need to read the value in the _Activate event?

What happened with my suggestion to write the value to a defined name?
Then in the report sheet you can retrieve it in a cell via...

=CallerID

...so it automatically appears when the sheet is activated.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



GS[_2_]

sheet event wait for another event?
 
Optionally, if you require the caller on the roster sheet be written to
a specific cell on the report sheet...

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
Sheets("Report").Range("CallerID") = Target.Parent
End Sub

...which assumes the cell is named "CallerID", and it has local scope.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion



[email protected]

sheet event wait for another event?
 
On Saturday, February 22, 2014 10:57:28 PM UTC-6, GS wrote:
Optionally, if you require the caller on the roster sheet be written to

a specific cell on the report sheet...



Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

Sheets("Report").Range("CallerID") = Target.Parent

End Sub



..which assumes the cell is named "CallerID", and it has local scope.



--

Garry

I did write information. I did this on the sheet containing the hyperlink cell:
Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)

Dim oWs As Worksheet: set oWs = openWorksheetByCodeName(SHEET_IT_OWNER)
oWs.Range("from_hyper_link").Value = Target.Name

Set oWs = Nothing

End Sub

Not the same info but same idea. Since event management doesn't look like a good idea I'll try writing the report from the followhyperlink event itself.



[email protected]

sheet event wait for another event?
 
That worked. The report can be written from the hyperlink caller's event.

I tried leaving information on the caller and target sheets for the report's activate event to read and work with. Neither worked. The information just isn't ready until the activate event is done.

Thank you for your help.

GS[_2_]

sheet event wait for another event?
 
That worked. The report can be written from the hyperlink caller's
event.

I tried leaving information on the caller and target sheets for the
report's activate event to read and work with. Neither worked. The
information just isn't ready until the activate event is done.

Thank you for your help.


Glad you got it working! Glad to be some help toward that end...

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion




All times are GMT +1. The time now is 05:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com