Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
DocuMike
 
Posts: n/a
Default Attn: Dave P. Question re Pix Calls via Macro

Dave, the solution you provided is working wonderfully...of course now I have
to stretch the envelope again! I was wondering, if I have another cell on
the same sheet where I want to put another set of graphics called via a
VLOOKUP as before, what code do I put in the first sheet since I can't use
the same VLOOKUP as the first one. I tried plugging the same code into sheet
a second time, only specifying the second cell location & VLOOKUP code but it
faults on the second "Worksheet_Calculation liine.
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

You only get one of those worksheet_calculate events per worksheet.

So if you want your routine to do more, you have to put it into that same
procedure.

I'm guessing that you're going to use more pictures with another unique prefix.

I chose DM01_ and DM02_ for my prefixes. (But you could use whatever you
want/have.)

And I've forgotten if you embedded the value into the cell or combine it in
code. But this might get you closer.



Option Explicit
Private Sub Worksheet_Calculate()

Dim oPic As Picture
Dim myPrefixes As Variant
Dim myAddresses As Variant
Dim iCtr As Long

myPrefixes = Array("DM01_", "DM02_")
myAddresses = Array("P16", "Q16")

For Each oPic In Me.Pictures
For iCtr = LBound(myPrefixes) To UBound(myPrefixes)
If LCase(Left(oPic.Name, Len(myPrefixes(iCtr)))) _
= LCase(myPrefixes(iCtr)) Then
With Me.Range(myAddresses(iCtr))
If LCase(oPic.Name) = LCase(.Text) Then
oPic.Visible = True
oPic.Top = .Top
oPic.Left = .Left
Else
oPic.Visible = False
End If
End With
End If
Next iCtr
Next oPic

End Sub


DocuMike wrote:

Dave, the solution you provided is working wonderfully...of course now I have
to stretch the envelope again! I was wondering, if I have another cell on
the same sheet where I want to put another set of graphics called via a
VLOOKUP as before, what code do I put in the first sheet since I can't use
the same VLOOKUP as the first one. I tried plugging the same code into sheet
a second time, only specifying the second cell location & VLOOKUP code but it
faults on the second "Worksheet_Calculation liine.


--

Dave Peterson
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
Macro - - Automation Jac Excel Discussion (Misc queries) 8 December 27th 04 02:42 PM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM
macro interruption: help!!! mario milani Excel Discussion (Misc queries) 1 November 30th 04 06:02 PM


All times are GMT +1. The time now is 03:53 PM.

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

About Us

"It's about Microsoft Excel"