Solved

bug in excel VBA?

Posted on 1998-10-14
6
191 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
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now