Solved

bug in excel VBA?

Posted on 1998-10-14
6
197 Views
Last Modified: 2010-04-30
Hi,

  I encountered something very strange in Excel VBA. I have created a number of labels and want to control their visibility under a certain cases. For example, whenever I click on a button, the labels will toggle their visibility. I found that when the number of labels is less than 13, it works fine. Otherwise, some labels still show up even I set their visibility to be False..  Did anybody encounter this before? Is this a known bug? Any comment is appreciated!

sunjian
0
Comment
Question by:sunjian061197
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Expert Comment

by:fguerreiro_inix
ID: 1440023
Try DoEvents, to do forgotten events.

Regards
0
 

Author Comment

by:sunjian061197
ID: 1440024
Hi fguerreiro_inix:

  Would you pls elaberate more? You see my code might just look like following:

Sub command1_click()
label1.visible=false
label2.visible=false
.
label12.visible=false
label13.visible=false
end sub

However, after i click the command button, label13 is still visible...

sunjian
0
 
LVL 2

Expert Comment

by:shchuka
ID: 1440025
What version of excel are you using?  I just tried what you said in Excel 97 - and all 13 labels got hidden.  I think there's something with your code.  Make sure you reference the names correctly.  Maybe, your 13th label has name different than 'label13' and you have 'on error resume next' or something like this so that it doesn't give you an error.

-Aleks.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 13

Accepted Solution

by:
Mirkwood earned 50 total points
ID: 1440026
No problem in Excel 97.

I tried the code below
   Label1.Visible = Not Label1.Visible
    Label2.Visible = Not Label2.Visible
    Label3.Visible = Not Label3.Visible
    Label4.Visible = Not Label4.Visible
    Label5.Visible = Not Label5.Visible
    Label6.Visible = Not Label6.Visible
    Label7.Visible = Not Label7.Visible
    Label8.Visible = Not Label8.Visible
    Label9.Visible = Not Label9.Visible
    Label10.Visible = Not Label10.Visible
    Label11.Visible = Not Label11.Visible
    Label12.Visible = Not Label12.Visible
    Label13.Visible = Not Label13.Visible
    Label14.Visible = Not Label14.Visible
    Label15.Visible = Not Label15.Visible
    Label16.Visible = Not Label21.Visible
    Label17.Visible = Not Label21.Visible
    Label18.Visible = Not Label21.Visible
    Label19.Visible = Not Label21.Visible
    Label20.Visible = Not Label21.Visible
    Label21.Visible = Not Label21.Visible
    Label22.Visible = Not Label22.Visible
    Label23.Visible = Not Label23.Visible
    Label24.Visible = Not Label24.Visible
    Label25.Visible = Not Label25.Visible
    Label26.Visible = Not Label26.Visible
    Label27.Visible = Not Label27.Visible
    Label28.Visible = Not Label28.Visible
    Label29.Visible = Not Label29.Visible
    Label30.Visible = Not Label30.Visible



0
 

Author Comment

by:sunjian061197
ID: 1440027
ooops!!! My excel version is also Excel 97... Let me check and try again...

sunjian
0
 

Author Comment

by:sunjian061197
ID: 1440028
Hi!

  I still got problem when I do it in that computer... But after I changed to another PC, it's all fine. I checked out my typings very carefully and there shouldn't be any error....

sunjian
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month4 days, 13 hours left to enroll

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question