Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Xen Xen is offline
external usenet poster
 
Posts: 1
Default Event Macro With Multiple Pictures

Hi,

To paint a picture for you all. Sheet 1 is a basic spreadsheet, the
important part being i have a heading and a picture that goes with it. For eg
Heading might be "Panther" and i have a jpg of a panther that sits above the
heading. Sheet 2 is a small table with heading in one coloumn and a jpg
reference in the other,

I usually Retype a heading then drag the correct jpg to the new location. I
found this macro which works fine for cell reference but i cant get it to
work for other cells on the same sheet.
Have got the following macro working fine using a Vlookup formula in cell
"A3":

Option Explicit

Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
With Range("A3")
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
So i all do is type in Panther and the jpg auto appears, fantastic!

Problem is i want this function to work at cell D3 also. note ("A3:D3") does
not work).

Any help or suggestions would be greatly appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Event Macro With Multiple Pictures

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 Thu, 10 Jul 2008 10:09:25 -0700, Xen wrote:

Hi,

To paint a picture for you all. Sheet 1 is a basic spreadsheet, the
important part being i have a heading and a picture that goes with it. For eg
Heading might be "Panther" and i have a jpg of a panther that sits above the
heading. Sheet 2 is a small table with heading in one coloumn and a jpg
reference in the other,

I usually Retype a heading then drag the correct jpg to the new location. I
found this macro which works fine for cell reference but i cant get it to
work for other cells on the same sheet.
Have got the following macro working fine using a Vlookup formula in cell
"A3":

Option Explicit

Private Sub Worksheet_Calculate()
Dim oPic As Picture
Me.Pictures.Visible = False
With Range("A3")
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
So i all do is type in Panther and the jpg auto appears, fantastic!

Problem is i want this function to work at cell D3 also. note ("A3:D3") does
not work).

Any help or suggestions would be greatly appreciated.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Event Macro running another macro inside K1KKKA Excel Discussion (Misc queries) 1 December 20th 06 08:21 PM
Developing macro event to allow multiple choices on drop down menu Brendan Excel Worksheet Functions 2 July 6th 06 04:31 PM
It seems to me that I need an event Macro, nick s Excel Worksheet Functions 8 November 28th 05 05:37 PM
'Event' macro George Gee New Users to Excel 18 August 27th 05 12:50 PM
Event Macro stevepain Excel Discussion (Misc queries) 6 August 5th 05 05:11 AM


All times are GMT +1. The time now is 04:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"