Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro-Based on Range of Values I Need Image To Populate 2

Status
Not open for further replies.

DrMingle

Technical User
May 24, 2009
116
US
I'm not sure where to start....

I have an image that is hidden within a sheet which needs to be pulled if cell C85 is between 95% and 100%...

I would use condtiional formating, but I can only deal with fonts, borders, and cell shading.

Any help....would be appreciated...
 



Hi,

How did you HIDE this image?

Please post the code that you are using.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
To hide Excel worksheets to prevent unwanted changes, Select the worksheet, click Format...Sheet...Hide.

Unfortunately I don't have any real code for this yet...

I'm not sure what to do...

I know the outcome and the if...then statement, but that's about it...

For example, I know that when C85 of the sheet "Master Appraisal" is 95% to 100% I want to display the image which is hidden on sheet 1 of the same workbook...

Does this help?

This is what I have so far...

Sub QualitySealInsert()
'
' Macro4 Macro
' Macro recorded 6/7/2009 by drmingle
'

'
Sheets("Sheet1").Select
ActiveSheet.Shapes("Picture 1").Select
Selection.Copy
Sheets("Master Appraisal").Select
ActiveWindow.SmallScroll Down:=-15
Range("J1").Select
ActiveSheet.PasteSpecial Format:="Picture (PNG)", Link:=False, _
DisplayAsIcon:=False
End Sub
 
The more I think about it...

When the below macro is asked to be executed I need to either call the image or not depending on the cell value of C85....and than after that...perform the Save As feature...

Can you help with this...? I have included the code I use for the Save As feature. The save as event would be the appropriate time to assign the image...otherwise the value of C85 fluctuates throughout the process...only at the save as event does the value of C85 become static...

Sub SaveAsNameDateScore()
If Trim(Range("B2")) = "" Then
MsgBox "Please enter Specialist Name"
Exit Sub
End If
If Not IsDate(Range("B5")) Then
MsgBox "Please enter Audit Completed Date"
Exit Sub
End If
If Not IsDate(Range("B4")) Then
MsgBox "Please enter Process Completed Date"
Exit Sub
End If
If Not IsNumeric(Range("C85")) Then
MsgBox "Please enter Average Quality Score"
Exit Sub
End If
ThisFile = "Visual Audit_" & " " & Range("B2").Text & " " & Replace(Range("B5").Text, "/", "-") & " " & Range("C85").Text
ActiveWorkbook.SaveAs Filename:=ThisFile
End Sub
 


Code:
Sub QualitySealInsert()
'
' Macro4 Macro
' Macro recorded 6/7/2009 by drmingle
'

'
    If [i]somesheetobject[/i].[C85] >= 0.95 And somesheetobject.[C85] <= 1 Then
        Sheets("Sheet1").Shapes("Picture 1").Copy
        Sheets("Master Appraisal").Range("J1").PasteSpecial _
            Format:="Picture (PNG)", _
            Link:=False, DisplayAsIcon:=False
    End If
End Sub
whatever sheet your cell C85 is on nees to be substituted.

I don't understand what your other question is.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Error 424 is showing up...

...I'm being asked to debug this line...
If somesheetobject.[C85] >= 95 And somesheetobject.[C85] <= 100 Then

Any ideas...

My other question was me expressing my wanting to take the code that you developed and place it in my save as code...so that I could run your code just before I actually saved the file...I'm not sure how to do this...



 


whatever sheet your cell C85 is on needs to be substituted.
refers to...
Code:
    If [i]somesheetobject[/i].[C85] >= 95 And [i]somesheetobject[/i].[C85] <= 100 Then

What sheetobject is C85 in?




Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
What about this ?
Code:
Sub SaveAsNameDateScore()
If Trim(Range("B2")) = "" Then
  MsgBox "Please enter Specialist Name"
  Exit Sub
End If
If Not IsDate(Range("B5")) Then
  MsgBox "Please enter Audit Completed Date"
  Exit Sub
End If
If Not IsDate(Range("B4")) Then
  MsgBox "Please enter Process Completed Date"
  Exit Sub
End If
If Not IsNumeric(Range("C85")) Then
  MsgBox "Please enter Average Quality Score"
  Exit Sub
End If
[!]If Range("C85") >= 0.95 And Range("C85") <= 1 Then
  Sheets("Sheet1").Shapes("Picture 1").Copy
  Sheets("Master Appraisal").Range("J1").PasteSpecial _
      Format:="Picture (PNG)", Link:=False, DisplayAsIcon:=False
End If[/!]
ThisFile = "Visual Audit_" & " " & Range("B2").Text & " " & Replace(Range("B5").Text, "/", "-") & " " & Range("C85").Text
ActiveWorkbook.SaveAs Filename:=ThisFile
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top