Why error when looping a sheets collection and setting the visible property?

I get an error on line 5 when running the following code:
1Sub ShowSheets(vSheets() As Variant)
2
3 Dim i As Long
4 For i = LBound(vSheets, 1) To UBound(vSheets, 1)
5 ThisWorkbook.Sheets(vSheets(i, 1)).Visible = xlSheetVisible
6 Next i
7
8End Sub
The error code I get is:
Run-time error '-2147417848 (80010108)':
Method 'Visible' of object '_Worksheet' failed
I only get the error when at least one of the sheets is a chart. But the error does not occur when the chart object is looping. Instead it occurs when the first worksheet object after the chart object is looping.
What is the cause of this error?

Hi JP3O,
>> only get the error when at least one of the sheets is a chart. But the error does not occur when the chart object is looping<<
I am trying to reproduce this issue however failed. From the error message, it seems that the visible couldn't set when you call the sub.
How the code was executed? Would you mind sharing more detail about this secnario?
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • Hi there! So I am using Lightroom 3 on a pc and I have ran into an issue when exporting images. The DPI and image size (in inches) that I am selecting during the export process. For example I just exported a collection and set the dpi to 180 and the size

    Hi there! So I am using Lightroom 3 on a pc and I have ran into an issue when exporting images. The DPI and image size (in inches) that I am selecting during the export process. For example I just exported a collection and set the dpi to 180 and the size to 7 inches on the long edge. My exported result is 457 dpi and sized at 3200x2134 pixels.. Any ideas on why this is happening and what I can do to correct it?

    The DPI setting in a digital image has no meaning at all. You need to learn how to calculate what you need in your exported image. The only measurement in a digital image that has any meaning is the number of pixels in each direction. It doesn't matter what you set that DPI to (actually it's PPI or pixels per inch). The image will have the same number of pixels regardless of the setting. If you need an image that is 5 x 7" (for example) at 200 PPI then you would want an image that measured:
    5 x 200 = 1000 pixels
    7 x 200 = 1400 pixels
    So you would need an image that is 1000 x 1400 pixels to have a 5 x 7" image at 200 PPI. The reason your exported image had such a high PPI setting is because you specified the number of inches you wanted the image to be. And there were enough pixels in the image that it calculated out to be that high PPI setting.
    I apologize, I don't explain this very well. But you need to learn to do the math to determine how large you really want your exported images to be.

  • I have the latest Creative Cloud versions of Lightroom and Lightroom Mobile on my Ipad. On my desktop I have created a collection which I have put in a custom order. On my Ipad I go into that collection and set the order to custom order, which I presume m

    I have the latest Creative Cloud versions of Lightroom and Lightroom Mobile on my Ipad. On my desktop I have created a collection which I have put in a custom order. On my Ipad I go into that collection and set the order to custom order, which I presume means the order I have on my desktop. However, the photos on the Ipad seem to be just random photos from the collection THEN the rest of the collection is in the correct order after that.

    Do you have virtual copies in your collection?
    Could you please send send me a LR Desktop +Mobile diagnostig log  - best as a private message with a downloadable dropbox link
    You can trigger the Lr Desktop diagnostig log via LR Desktop preferences -> Lightroom Mobile and when you hold down the alt key you will notice a generate diagnostic log button.
    The Lr Mobile app log can be triggered when you open up the settings and long press the to LR Icon a diagnostic log will be generated and attached to your local mail client. While opening the settings could you double check if you are signed-in?
    Thanks
    Guido

  • When i inter to options and set the font in the content tab to larger number like 20 or another number and click ok it not respond and the font stell as it is what i can do for solving that problem ?

    when opening the firefox page and go to search the font is small and when try to make it large throught the content tab it not respond

    Hi Gaurav 
    I already locked for a OSS note, but i could not find the answer
    Please, Could you tell me how you solve the problem?
    Thanks
    Ariel

  • Error when generating program /SAPAPO/TSM141 and Errors in source system

    Hello APO Experts!
    I had to include a new key figure in the cube and the planning area with configuration semantic = 000.
    The problem is, in my DEV system, the modification was perfect. Then when I did in the QA system, I´ve got the error "Error when generating program /SAPAPO/TSM141" and u201CErrors in source systemu201D when trying to load data in the Infopackage.
    Do you have any idea of what this could be?
    Best Regards
    Nik

    Hello,
    The problem may come from the inconsistency between the datasource settings and the content in table /SAPAPO/TSAREATE.
    - SE16, go to table /SAPAPO/TSAREATE, input the planning area name, check the extraction structure, which is started from  '/1APO/EXT_STRU'.
    - SE16, go to table /SAPAPO/TSAREAEX, input the datasource name, and check the extraction structure.
    Are the two extraction structures the same or different ?
    If they're different, please read the below solutions, otherwise, you can ignore the following.
    In general and most customer cases this inconsistency happens during transporting of datasource alone. In many cases the planning area is directly created at target system and datasoucre transported from a a different system which causes incorrect export structure entry in planning area table.
    Please refer to following content from note 549184:
    Q4: Why could I have extraction problem after transport of DataSource?
    A4: DataSources for DP/SNP planning areas depend directly on the  structure of the planning areas. That's why the planning area MUST  ALWAYS be transported with or before the DataSource.
    The simple solution will be to create a dummy data source for this planning area. This will regenerate the extract structure for all other data sources as well and update the corresponding tables. After that you can delete the dummy datasource.
    After delete the dummy datasource, in case of inconsistency, please also run the report /SAPAPO/TS_PSTRU_GEN report for
    - Basis - form routines
    - Create planning objects
    - Planning area extractor
    with the flags "Reset generation time stamp" and "Generate" set.
    And in order to transfer datasource correctly, please also refer to the consulting note 514524.
    Best Regards,
    Ada

  • Have a  problem with Lightroom 5.4.  Since the program crashed yesterday it won't launch, it comes up with the message "Lightroom encountered an error when reading its preview cache and needs to quit".  "  Lightroom will attempt to fix this problem net ti

    Have a  problem with Lightroom 5.4.  Since the program crashed yesterday it won't launch, it comes up with the message "Lightroom encountered an error when reading its preview cache and needs to quit".  "  Lightroom will attempt to fix this problem next time it launches".  Except that it doesn't, I keep getting the same message and the program closes.  Does anyone know what I  can do to repair it?  Can't back up, can't do anything.

    There are dozens of threads in this forum that describe the fix

  • When opening my lightroom 5- It pops up Lightroom encountered an error when reading its preview Cache and needs to quit.... Can someone walk me through the steps!?

    Opening my lightroom 5.. I get a message that Lightroom encountered an error when reading its preview Cacge and needs to quit.
    Can someone walk me through the steps. Im dealing with MAC computer

    Go to the folder containing your catalog and delete the folder with the extension .lrdata. Then start Lightroom, and it will begin creating a new cache file.
    If you need to know where the files are: Preference and other file locations in Lightroom 5

  • How can I reformat my hard drive if erase and partition don't work in disk utility and I get an error when I try to erase and install from the Leopard install disk?  I have had several kernel panics, but the volume shows up in startup disk.

    I have had several kernel panics on my iBook G4; the panic message shows up just after the desktop appears. Although the startup volume shows up in Startup Disk, the installation disk reports an error when I attempt an erase and install. Disk utility is unable either to erase or partition the hard drive. The hard drive shows up in disk utility, but the startup volume doesn’t  HELP!!!

    Do you have the original system discs that came with the iBook when it was new?
    Which exact iBook model is it?
    You can choose from this list:
    http://www.everymac.com/systems/apple/ibook/index-ibook.html
    Erasing the disc and installing Mac OS X 10.5 will result in loss of the other applications (such as the iLife applications) which came pre-installed on the iBook.

  • Why my calendar display different there is one day difference from different  when I see main screen and open the calendar

    See my Why my calendar display different there is one day difference from different  when I see main screen and open the calendar

    I too am having the same issue only I am in Regina, Canada.  iCloud appears to think Regina, Canada is in the Central time zone which it is, but it does not use Daylight Savings time.  My PC is Windows 7 and I am using Outlook 2010.  I have iCloud on iPhone 5 and iPad 2.   Terribly frustrating!

  • I have an error when installing apps on my mac from the apple store. It says "return to the purchase page and try again"... I think it is something to do with the installation process itself. I have tried to clear apple store cache, restarted apple s

    I have an error when installing apps on my mac from the apple store. It says "return to the purchase page and try again"... I think it is something to do with the installation process itself. I have tried to clear apple store cache, restarted apple store from debug menu, double checked my apple id account and etc..but doesn't work anyway.

    I'm having the same problem and went as far as to delete and reinstall the AppStore and still no dice.

  • Error When building ess/tra/tre and ess/tra/tre/trs DC's

    I had customized the ess/tra/tre and ess/tra/tre/trs DC's and had them working, but I do not know what I did or what happened that am now getting the following errors when building, can anyone help tell what the problem could be?
    Error                                     
    -     The project was not built since its classpath is incomplete. Cannot find the class file for com.sap.xss.tra.model.openccmodel.OVSOpenCostcenterModel. Fix the classpath then try rebuilding this project.               
    -     HDI_HNS15.02_Desstratresap.com                              
    Error                                     
    -     This compilation unit indirectly references the missing type com.sap.xss.tra.model.openccmodel.OVSOpenCostcenterModel (typically some required class file is referencing a type outside the classpath)        
    -      InternalVcTreReview.java          
    -      HDI_HNS15.02_Desstratresap.com/gen_wdp/packages/com/sap/xss/tra/tre/vc/review/wdp      
    -     line 0

    For anyone who might need to know, I managed to fix this by adding tra to the required projects on the build path. On the Navigator View, right click -> Properties -> Java Build Path -> Projects tab -> check dependant project.

  • I keep losing entire catalogs. I put in 30,000 images and cannot get to them. Put in 3,000 images and get error message "LR encountered error when reading its previous cash and needs to quit. LR will fix this problem the next time it loads.' I  have loade

    I keep losing entire catalogs. I put in 30,000 images and cannot get to them. Put in 3,000 images and get error message "Light room encountered error when reading its previous cash and needs to quit. light room will fix this problem the next time it loads.'
    I  have loaded light room several times and even exited computer for 8 hours. Still get error message

    A search of this forum shows lots of threads where this issue of "error reading cache" is solved

  • I get an error that says that LR5 encounterd a preview cach error when trying to start LR5 and that it will try to fix it the next time it starts. What can I do to fix this error?

    I get an error that says that LR5 encountered a preview cache error when trying to start LR5 and that it will try to fix it the next time it starts. What can I do to fix this error?

    Go to the folder with you Lightroom Catalog (usually in Pictures) and delete the folder ending in .lrpreviews
    This contains the previews for the files Lightroom has linked to. They will need to be rebuilt which can be done while working or selecting an amount you want to rebuild and accessing the rebuild command in the Library Dropdown menu...

  • Windows installer package not running or installing properly error when i try to install and update to the new icloud control panel.

    i get a windows installer package not running or installing properly error when i try to install and update to the new icloud control panel.

    Okay ... so it's not one of the cases of bodged up ACLs on the Apple folder in Common Files. (That's been underlying a few of the recalcitrant E7W5s.
    Just in case, let's try the fixit from the following document:
    Fix problems with programs that can't be installed or uninstalled

  • Pls have been having issues upgrading to the os 10.9. downloads encounter error when it gets to 955mb and starts over again-.suggestions pls?

    pls have been having issues upgrading to the os 10.9. downloads encounter error when it gets to 955mb and starts over again….suggestions pls?

    http://www.apple.com/support/mac/app-store/contact/

Maybe you are looking for