BrianBarrett
New Member
- Joined
- Sep 7, 2011
- Messages
- 12
Excel 2003 VBA
This is very strange asI am having 2 issues that may or may not be connected or indictative of an underlying issue:
1) I have a number of sheets each with code, some the same, some different, that are attached to the activate event. They tend to turn off application.enableevents, do some changes, and turn it back on.
I have done some changes to one sheet, say sheet 1, and when I click on its tab, it appears but the activate event does not happen (I have put stop/debug buttons on the code). All other sheets do activate ok. I assume the application.enableevents code is universal across the whole workbook.
Strange is that to see if it is a sheet I am moving from that is responsible I have put a worksheet_deactivate event on another [for test purposes] sheet, say sheet 2. So now when I move from sheet 3 to sheet 2, the activation event for sheet 2 kicks in. When I move from sheet 2 to sheet 3, the sheet 2 deactivate event kicks in then the sheet 3 activation event. When I move from sheet 2 to sheet 1, however, neither the sheet 2 deactivate event nor the sheet 1 activation event happens.
2) Other issue. One process the sheet 1 activation process calls, though I have to manually call it now, is a formatting routine. The code is along the lines of:
for each singleCell in partRowOfCells
singleCell.entirecolumn.autofit
next
partRowOfCells is around 8 cells. When we are going around the loop, at about cell number 3, and on the autofit stage, the procedure just drops out. And I mean no line in debug is highlighted, no error is trapped. The procedure just ends. I believe the thread also ends, so we do not drop back to any calling routine.
This only happens on sheet 1 and not on the other sheets.
This is very strange asI am having 2 issues that may or may not be connected or indictative of an underlying issue:
1) I have a number of sheets each with code, some the same, some different, that are attached to the activate event. They tend to turn off application.enableevents, do some changes, and turn it back on.
I have done some changes to one sheet, say sheet 1, and when I click on its tab, it appears but the activate event does not happen (I have put stop/debug buttons on the code). All other sheets do activate ok. I assume the application.enableevents code is universal across the whole workbook.
Strange is that to see if it is a sheet I am moving from that is responsible I have put a worksheet_deactivate event on another [for test purposes] sheet, say sheet 2. So now when I move from sheet 3 to sheet 2, the activation event for sheet 2 kicks in. When I move from sheet 2 to sheet 3, the sheet 2 deactivate event kicks in then the sheet 3 activation event. When I move from sheet 2 to sheet 1, however, neither the sheet 2 deactivate event nor the sheet 1 activation event happens.
2) Other issue. One process the sheet 1 activation process calls, though I have to manually call it now, is a formatting routine. The code is along the lines of:
for each singleCell in partRowOfCells
singleCell.entirecolumn.autofit
next
partRowOfCells is around 8 cells. When we are going around the loop, at about cell number 3, and on the autofit stage, the procedure just drops out. And I mean no line in debug is highlighted, no error is trapped. The procedure just ends. I believe the thread also ends, so we do not drop back to any calling routine.
This only happens on sheet 1 and not on the other sheets.