WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

VBA code for sizing/showing pictures

 
   Home -> Office -> General Discussions RSS
Next:  vlookup to find match only part of a text value  
Author Message
Secret Squirrel

External


Since: Nov 30, 2005
Posts: 79



(Msg. 1) Posted: Wed Aug 27, 2008 5:51 pm
Post subject: VBA code for sizing/showing pictures
Archived from groups: microsoft>public>excel>misc (more info?)

I'm using the following code to size and display a specific picture based on
my list box in cell A4. It does a "VLOOKUP" from cell A5 and then displays
the picture that is tied to the selection in the list box. This code is
specific to cell A5 only. I need to duplicate this function to cell C4 and
cell C5. But I want the picture in cell C5 to be driven by the listbox in
cell C4. How do I set this up since my code is cell specific? I want these to
be independent of each other to allow users to be able to choose a picture
for A5 and then another picture for C5. Here is the VBA code that drives the
A4 listbox and then puts the picture in A5:

Private Sub Worksheet_Calculate()

Dim oPic As Picture
Me.Pictures.Visible = False
With Range("A5")
For Each oPic In Me.Pictures
If oPic.Name = .Text Then
oPic.Visible = True
oPic.ShapeRange.LockAspectRatio = msoFalse
oPic.Top = .Top
oPic.Left = .Left
oPic.Height = .Height
oPic.Width = .Width
oPic.Placement = xlMoveAndSize
Exit For
End If
Next oPic
End With
End Sub
Back to top
Login to vote
Gord Dibben

External


Since: Feb 23, 2004
Posts: 8285



(Msg. 2) Posted: Wed Aug 27, 2008 8:43 pm
Post subject: Re: VBA code for sizing/showing pictures [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Looks like John McGimpsey's lookuppics code.

Only allows for one image at a time to be displayed.

Got to Debra Dalgeish's site for a sample workbook from Bernie Dietrick for
adding pictures to selections.

Alows for more than one picture to be displayed based upon a value or item
chosen from DV lists

http://www.contextures.on.ca/excelfiles.html#DataVal

DV0049 - ClipArt Selection

Edit the code to suit.


Gord Dibben MS Excel MVP

On Wed, 27 Aug 2008 17:51:19 -0700, Secret Squirrel
<secretsquirrel.DeleteThis@discussions.microsoft.com> wrote:

>I'm using the following code to size and display a specific picture based on
>my list box in cell A4. It does a "VLOOKUP" from cell A5 and then displays
>the picture that is tied to the selection in the list box. This code is
>specific to cell A5 only. I need to duplicate this function to cell C4 and
>cell C5. But I want the picture in cell C5 to be driven by the listbox in
>cell C4. How do I set this up since my code is cell specific? I want these to
>be independent of each other to allow users to be able to choose a picture
>for A5 and then another picture for C5. Here is the VBA code that drives the
>A4 listbox and then puts the picture in A5:
>
> Private Sub Worksheet_Calculate()
>
> Dim oPic As Picture
> Me.Pictures.Visible = False
> With Range("A5")
> For Each oPic In Me.Pictures
> If oPic.Name = .Text Then
> oPic.Visible = True
> oPic.ShapeRange.LockAspectRatio = msoFalse
> oPic.Top = .Top
> oPic.Left = .Left
> oPic.Height = .Height
> oPic.Width = .Width
> oPic.Placement = xlMoveAndSize
> Exit For
> End If
> Next oPic
> End With
> End Sub
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> General Discussions All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET