+ Reply to Thread
Results 1 to 3 of 3

Pictures.Visible question (after adding many pictures, they stop disappearing)

  1. #1
    Abe
    Guest

    Pictures.Visible question (after adding many pictures, they stop disappearing)

    I have a worksheet which is filled with a bunch of pictures, and
    depending on the layout I have there will need to be up to 500-2,000
    pictures.... maybe more.

    There are only six 'different' pictures however, most are copies of a
    reference picture.

    I want to be able to hide all the pictures or show them depending on
    the value of a checkbox in a userform. Here is the code I have
    (chkQCAoverlay is a check box):

    Private Sub chkQCAoverlay_Change()

    On Error Resume Next
    Worksheets(2).Pictures.Visible = chkQCAoverlay.Value
    On Error GoTo 0

    End Sub

    The 'on error' is there in case there are no pictures on the worksheet.


    The code works if I have a few pictures (around 30) but if I have many
    more, it stops hiding the pictures. Anyone know what's going on?


  2. #2
    Dave Peterson
    Guest

    Re: Pictures.Visible question (after adding many pictures, they stopdisappearing)

    I've seen other code that works with shapes fail when there were lots of them.

    Maybe looping through all the pictures would be better:

    dim myPict as picture
    for each myPict in worksheets(2).pictures
    mypict.visible = chkqcaoverlay.value
    next mypict

    (watch out for typos--untested)

    Abe wrote:
    >
    > I have a worksheet which is filled with a bunch of pictures, and
    > depending on the layout I have there will need to be up to 500-2,000
    > pictures.... maybe more.
    >
    > There are only six 'different' pictures however, most are copies of a
    > reference picture.
    >
    > I want to be able to hide all the pictures or show them depending on
    > the value of a checkbox in a userform. Here is the code I have
    > (chkQCAoverlay is a check box):
    >
    > Private Sub chkQCAoverlay_Change()
    >
    > On Error Resume Next
    > Worksheets(2).Pictures.Visible = chkQCAoverlay.Value
    > On Error GoTo 0
    >
    > End Sub
    >
    > The 'on error' is there in case there are no pictures on the worksheet.
    >
    > The code works if I have a few pictures (around 30) but if I have many
    > more, it stops hiding the pictures. Anyone know what's going on?


    --

    Dave Peterson

  3. #3
    Abe
    Guest

    Re: Pictures.Visible question (after adding many pictures, they stop disappearing)

    Thanks Dave. That's a wierd quirk of Excel.
    -Abe

    Dave Peterson wrote:
    > I've seen other code that works with shapes fail when there were lots of them.
    >
    > Maybe looping through all the pictures would be better:
    >
    > dim myPict as picture
    > for each myPict in worksheets(2).pictures
    > mypict.visible = chkqcaoverlay.value
    > next mypict
    >
    > (watch out for typos--untested)
    >
    > Abe wrote:
    > >
    > > I have a worksheet which is filled with a bunch of pictures, and
    > > depending on the layout I have there will need to be up to 500-2,000
    > > pictures.... maybe more.
    > >
    > > There are only six 'different' pictures however, most are copies of a
    > > reference picture.
    > >
    > > I want to be able to hide all the pictures or show them depending on
    > > the value of a checkbox in a userform. Here is the code I have
    > > (chkQCAoverlay is a check box):
    > >
    > > Private Sub chkQCAoverlay_Change()
    > >
    > > On Error Resume Next
    > > Worksheets(2).Pictures.Visible = chkQCAoverlay.Value
    > > On Error GoTo 0
    > >
    > > End Sub
    > >
    > > The 'on error' is there in case there are no pictures on the worksheet.
    > >
    > > The code works if I have a few pictures (around 30) but if I have many
    > > more, it stops hiding the pictures. Anyone know what's going on?

    >
    > --
    >
    > Dave Peterson



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1