Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quirky, infrequent problem with code
Hello again gang,
Let's see if I can explain this quirk correctly.....I've posted all the code involved below. Here's what it's supposed to do: On UF2 there are 52 buttons, by clicking on any one of them you are taken to the "Data" sheet. Then that sheet is split and certain columns are hidden, depending upon the button selected on UF2. This allows the OP to see what he needs to see and enter data only in the cells that are unlocked. When the "Save Data" button on "Data" sheet is clicked all Cols are unhidden and the WB is saved and you are returned to UF2. This all works well, most of the time, however occassionally, after the button click on UF2, the program flashes and returns you to UF2. By clicking again on the button (sometimes it takes 3-4 clicks) the program will finally land on the "Data" sheet as it's supposed to. When this happens, no error msgs appear and it appears to do no harm to the WB, but it is very aggravating. It's also difficult to reproduce, as it only happens infrequently. Any help would be greatly appreciated in cornering this bug. The Layout: On "Data" sheet: Cols "A,B,C" are locked Rows "1,2" are locked All other cells are unlocked There is a Button ("Save Data") that resides over cells B2:C2 The below Sub Jul05 is reached through a button click on a form UF2 that I developed. There are 52 Subs that Call SplitDataSheet and then hide various Cols. Sub Jul05() Call SplitDataSheet Columns("G:IV").Select Selection.EntireColumn.Hidden = True Range("D3").Select ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True ActiveSheet.EnableSelection = xlUnlockedCells End Sub Sub SplitDataSheet() Sheets("DATA").Select ActiveSheet.Unprotect Columns("A:IV").Select Selection.EntireColumn.Hidden = False Range("D3").Select ActiveWindow.FreezePanes = True End Sub The "Save Data" button has the following code: Sub SaveData() ActiveSheet.Unprotect Columns("A:IV").Select Selection.EntireColumn.Hidden = False ActiveWindow.FreezePanes = False Range("A1").Select MsgBox "Workbook Will Now Be Saved!" ActiveWorkbook.Save UF2.Show End Sub I hope that's enough info to find this bug.....appreciate any help here, Don |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quirky, infrequent problem with code
Don i'm no whizz at this but have you tried Set Focus to an item on your UF2? maybe this will help..............maybe not, just a thought! Regards, Simon -- Simon Lloyd ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708 View this thread: http://www.excelforum.com/showthread...hreadid=571064 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Quirky, infrequent problem with code
G'mornin Simon, Thanks for looking at this. I guess I did forget something and that is the button click command, but that's pretty straight forward...code is: Private Sub CommandButton1_Click() Unload UF2 Call Jul05 End Sub I'm too am certainly not a whiz at this....I frequent here often for help, either by postings or by searches through the archives. As I said, this problem only happens infrequently and yesterday after posting my question, I couldn't for the life of me get the program to misbehave.....lol I'll code the following into UF2's code and see what happens. Private Sub UserForm_Activate() CommandButton1.SetFocus End Sub Meanwhile, any other comments or suggestions would be appreciated, Thanks again, Don "Simon Lloyd" wrote: Don i'm no whizz at this but have you tried Set Focus to an item on your UF2? maybe this will help..............maybe not, just a thought! Regards, Simon -- Simon Lloyd ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.excelforum.com/member.php...fo&userid=6708 View this thread: http://www.excelforum.com/showthread...hreadid=571064 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Formula is being quirky | Excel Worksheet Functions | |||
SUMPRODUCT Formula quirky.... | Excel Discussion (Misc queries) | |||
Quirky Problem With Links & Excel Versions | Excel Programming | |||
Quirky Code | Excel Programming | |||
Quirky Button | Excel Programming |