Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Don Don is offline
external usenet poster
 
Posts: 487
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
Don Don is offline
external usenet poster
 
Posts: 487
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formula is being quirky Pierre Excel Worksheet Functions 10 July 24th 07 05:35 AM
SUMPRODUCT Formula quirky.... j razz Excel Discussion (Misc queries) 5 March 28th 07 11:36 PM
Quirky Problem With Links & Excel Versions MDW Excel Programming 1 July 7th 06 05:16 PM
Quirky Code bodhisatvaofboogie Excel Programming 2 June 26th 06 02:18 PM
Quirky Button nbs Excel Programming 0 September 2nd 04 07:27 PM


All times are GMT +1. The time now is 05:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"