Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Passing a Variable from Worksheet to Workbook
I have a Sheet with several comboboxes (with linked cells). When the user
leaves the workbook I need to display a message if they have made changes to any of the combo boxes. Each has a change event like below...... The first line just fills in a default if it is null The second line forces the worksheet change event which determines if the change is for one of the designated cells and sets the value of blnchgseg to True. Now I need to ..... If blnchgseg = True Then SegMsg (display the message)..... but the workbook does not know about blnchgseg and the worksheet_deactivate does not fire when the user move to another workbook. Can I define a static variable so both worksheet and workbook know about it ? Have I gone 'round the bend on this one???? Private Sub ComboBox1_Change() If IsNull(Me.ComboBox1) Then Me.ComboBox1 = Range("aY7") Worksheet_Change Range(Me.ComboBox1.LinkedCell) End Sub Private Sub Worksheet_Change(ByVal Target As Range) Static blnchgseg As Boolean For intx = 1 To Range("trsegsmapped").Rows.Count If Target.Address = Range("trsegsmapped")(intx).Address Then blnchgseg = True Exit For End If Next intx End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Passing Variable Number of Arguments to a Sub | Excel Discussion (Misc queries) | |||
Passing Variable to LINEST | Excel Worksheet Functions | |||
passing a variable as an argument to a function | Excel Programming | |||
UserForm not passing Boolean variable | Excel Programming | |||
Passing a value to a variable from Userform | Excel Programming |