+ Reply to Thread
Results 1 to 6 of 6

Declear which picture I want to show and not?!

  1. #1
    Registered User
    Join Date
    07-14-2006
    Posts
    11

    Declear which picture I want to show and not?!

    Hi!
    Here is same code I have wrote:

    Private Sub Worksheet_Calculate()
    Dim oPic As Picture
    Me.Pictures.Visible = False
    With Range("B41")
    For Each oPic In Me.Pictures
    If oPic.Name = .Text Then
    oPic.Visible = True
    oPic.Top = .Top
    oPic.Left = .Left
    Exit For
    End If
    Next oPic
    End With
    End Sub

    Now all the pictures in the document get invisible!
    I want to declear which picture that should be visible or not. Ex. I want to make picture 1-11 visible = False. How?
    How do I decler that a specific picture should be visible, "Picture 101.Visible = True"?

    Thanks?

  2. #2
    NickHK
    Guest

    Re: Declear which picture I want to show and not?!

    From your code, you are hiding all pictures. Then making the one that
    matches the text visible and moving it over cell B41.
    So if you want more pictures visible, you need to test for in your For/Next
    loop and set them to .visible=true

    Where is you list of pictures to make visible ?

    NickHK

    "petterss" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi!
    > Here is same code I have wrote:
    >
    > Private Sub Worksheet_Calculate()
    > Dim oPic As Picture
    > Me.Pictures.Visible = False
    > With Range("B41")
    > For Each oPic In Me.Pictures
    > If oPic.Name = .Text Then
    > oPic.Visible = True
    > oPic.Top = .Top
    > oPic.Left = .Left
    > Exit For
    > End If
    > Next oPic
    > End With
    > End Sub
    >
    > Now all the pictures in the document get invisible!
    > I want to declear which picture that should be visible or not. Ex. I
    > want to make picture 1-11 visible = False. How?
    > How do I decler that a specific picture should be visible, "Picture
    > 101.Visible = True"?
    >
    > Thanks?
    >
    >
    > --
    > petterss
    > ------------------------------------------------------------------------
    > petterss's Profile:

    http://www.excelforum.com/member.php...o&userid=36354
    > View this thread: http://www.excelforum.com/showthread...hreadid=570683
    >




  3. #3
    Registered User
    Join Date
    07-14-2006
    Posts
    11
    Hi!
    The picture I want to be visible are placed in different places in the document. And in a specific cell I want to show a picture from a list depending of a choice in an other cell and the other pictures in this list should be hide.
    Can I declear a specific picture to visible? I´m a amateur in VB and would be happy with some excempel!

    THanks!

    Quote Originally Posted by NickHK
    From your code, you are hiding all pictures. Then making the one that
    matches the text visible and moving it over cell B41.
    So if you want more pictures visible, you need to test for in your For/Next
    loop and set them to .visible=true

    Where is you list of pictures to make visible ?

    NickHK

    "petterss" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi!
    > Here is same code I have wrote:
    >
    > Private Sub Worksheet_Calculate()
    > Dim oPic As Picture
    > Me.Pictures.Visible = False
    > With Range("B41")
    > For Each oPic In Me.Pictures
    > If oPic.Name = .Text Then
    > oPic.Visible = True
    > oPic.Top = .Top
    > oPic.Left = .Left
    > Exit For
    > End If
    > Next oPic
    > End With
    > End Sub
    >
    > Now all the pictures in the document get invisible!
    > I want to declear which picture that should be visible or not. Ex. I
    > want to make picture 1-11 visible = False. How?
    > How do I decler that a specific picture should be visible, "Picture
    > 101.Visible = True"?
    >
    > Thanks?
    >
    >
    > --
    > petterss
    > ------------------------------------------------------------------------
    > petterss's Profile:

    http://www.excelforum.com/member.php...o&userid=36354
    > View this thread: http://www.excelforum.com/showthread...hreadid=570683
    >

  4. #4
    NickHK
    Guest

    Re: Declear which picture I want to show and not?!

    That's what you are doing here.
    You are making visible the picture whose .Name matches the .Text in B41.

    From your description, I don't see why your code does not do what you need;
    hide all except the one with that name.

    NickHK

    "petterss" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi!
    > The picture I want to be visible are placed in different places in the
    > document. And in a specific cell I want to show a picture from a list
    > depending of a choice in an other cell and the other pictures in this
    > list should be hide.
    > Can I declear a specific picture to visible? I´m a amateur in VB and
    > would be happy with some excempel!
    >
    > THanks!
    >
    > NickHK Wrote:
    > > From your code, you are hiding all pictures. Then making the one that
    > > matches the text visible and moving it over cell B41.
    > > So if you want more pictures visible, you need to test for in your
    > > For/Next
    > > loop and set them to .visible=true
    > >
    > > Where is you list of pictures to make visible ?
    > >
    > > NickHK
    > >
    > > "petterss" <[email protected]>
    > > wrote in
    > > message news:[email protected]...
    > > >
    > > > Hi!
    > > > Here is same code I have wrote:
    > > >
    > > > Private Sub Worksheet_Calculate()
    > > > Dim oPic As Picture
    > > > Me.Pictures.Visible = False
    > > > With Range("B41")
    > > > For Each oPic In Me.Pictures
    > > > If oPic.Name = .Text Then
    > > > oPic.Visible = True
    > > > oPic.Top = .Top
    > > > oPic.Left = .Left
    > > > Exit For
    > > > End If
    > > > Next oPic
    > > > End With
    > > > End Sub
    > > >
    > > > Now all the pictures in the document get invisible!
    > > > I want to declear which picture that should be visible or not. Ex. I
    > > > want to make picture 1-11 visible = False. How?
    > > > How do I decler that a specific picture should be visible, "Picture
    > > > 101.Visible = True"?
    > > >
    > > > Thanks?
    > > >
    > > >
    > > > --
    > > > petterss
    > > >

    > > ------------------------------------------------------------------------
    > > > petterss's Profile:

    > > http://www.excelforum.com/member.php...o&userid=36354
    > > > View this thread:

    > > http://www.excelforum.com/showthread...hreadid=570683
    > > >

    >
    >
    > --
    > petterss
    > ------------------------------------------------------------------------
    > petterss's Profile:

    http://www.excelforum.com/member.php...o&userid=36354
    > View this thread: http://www.excelforum.com/showthread...hreadid=570683
    >




  5. #5
    Registered User
    Join Date
    07-14-2006
    Posts
    11
    It does, the problem is that it hiding other pictures to(ex one logo, one picture in the Heading). Pictures that dont have anything to do with the list!
    Thats why I want to declear picture 102,103 and 104 to visible!
    Is it possible?


    Quote Originally Posted by NickHK
    That's what you are doing here.
    You are making visible the picture whose .Name matches the .Text in B41.

    From your description, I don't see why your code does not do what you need;
    hide all except the one with that name.

    NickHK

    "petterss" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi!
    > The picture I want to be visible are placed in different places in the
    > document. And in a specific cell I want to show a picture from a list
    > depending of a choice in an other cell and the other pictures in this
    > list should be hide.
    > Can I declear a specific picture to visible? I´m a amateur in VB and
    > would be happy with some excempel!
    >
    > THanks!
    >
    > NickHK Wrote:
    > > From your code, you are hiding all pictures. Then making the one that
    > > matches the text visible and moving it over cell B41.
    > > So if you want more pictures visible, you need to test for in your
    > > For/Next
    > > loop and set them to .visible=true
    > >
    > > Where is you list of pictures to make visible ?
    > >
    > > NickHK
    > >
    > > "petterss" <[email protected]>
    > > wrote in
    > > message news:[email protected]...
    > > >
    > > > Hi!
    > > > Here is same code I have wrote:
    > > >
    > > > Private Sub Worksheet_Calculate()
    > > > Dim oPic As Picture
    > > > Me.Pictures.Visible = False
    > > > With Range("B41")
    > > > For Each oPic In Me.Pictures
    > > > If oPic.Name = .Text Then
    > > > oPic.Visible = True
    > > > oPic.Top = .Top
    > > > oPic.Left = .Left
    > > > Exit For
    > > > End If
    > > > Next oPic
    > > > End With
    > > > End Sub
    > > >
    > > > Now all the pictures in the document get invisible!
    > > > I want to declear which picture that should be visible or not. Ex. I
    > > > want to make picture 1-11 visible = False. How?
    > > > How do I decler that a specific picture should be visible, "Picture
    > > > 101.Visible = True"?
    > > >
    > > > Thanks?
    > > >
    > > >
    > > > --
    > > > petterss
    > > >

    > > ------------------------------------------------------------------------
    > > > petterss's Profile:

    > > http://www.excelforum.com/member.php...o&userid=36354
    > > > View this thread:

    > > http://www.excelforum.com/showthread...hreadid=570683
    > > >

    >
    >
    > --
    > petterss
    > ------------------------------------------------------------------------
    > petterss's Profile:

    http://www.excelforum.com/member.php...o&userid=36354
    > View this thread: http://www.excelforum.com/showthread...hreadid=570683
    >

  6. #6
    Ken Johnson
    Guest

    Re: Declear which picture I want to show and not?!

    Hi,

    If you are wanting Picture 102, Picture 103 and Picture 104 to remain
    visible at all times then try...

    Private Sub Worksheet_Calculate()
    Dim oPic As Picture
    For Each oPic In Me.Pictures
    Select Case oPic.Name
    Case "Picture 102", "Picture 103", "Picture 104"
    Case Else
    oPic.Visible = False
    End Select
    Next oPic
    With Range("B41")
    For Each oPic In Me.Pictures
    If oPic.Name = .Text Then
    oPic.Visible = True
    oPic.Top = .Top
    oPic.Left = .Left
    Exit For
    End If
    Next oPic
    End With
    End Sub

    Ken Johnson


+ 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