In Excel VBA I have created a global variable; Public xxxxActive As Boolean and placed…
Jump to turn (7)
- 1In Excel VBA I have created a global variable; Public xxxxActive As Boolean and
- 2This code is supposed to take the values of the last row from B to L and put the
- 3if some of the cells in the row are blank, not B it always has a value, will it
- 4How then can I call this code from the WorkSheet Activate routine. Sub ColumnLis
- 5I got the code to work as required. It does take a couple of seconds bu this is
- 6After this code has run, what is the correct code to select the last cell in col
- 7the following commands are not closing word; wordApp.Quit Set wordApp = Nothing
- User
In Excel VBA I have created a global variable; Public xxxxActive As Boolean and placed it in a Module of its own.
In sheet1 just before I activate another sheet, i change the global variable;
xxxxActive = True Sheet2.Select
In sheet2 at the start of a VBA routine and within the sub i use; Sub Start of Routine() If Not xxxxActive Then Exit Sub to check if the module is True. If the module is True it allows the rest of the code to run, if false it exits the sub.
In sheet2 in my Worksheet_Deactivate routine, I use xxxxActive = False to change the global routine to False. What I have found is that if I go back to sheet1, the statement xxxxActive = True only works if it is the Private Sub Worksheet_Activate() routine. If in sheet1 I place the statement xxxxActive = True in another sub routine, it does not change the xxxxActive back to True. I was hoping to only be able to change the xxxxActive to True by the events of a VBA within sheet1. What might be the cause of this.
- Assistant