changeing name variabels
changeing name variabels
(OP)
I would like to get an image to change by cheking a sertain value in an excel sheet.
if the scheet have the value 3 the folowing should happen:
Variable = TextBox273 = ws2.Cells(24, 94).Value ('the value 3)
Image12.Picture = DetailSelect.Image3.Picture
Hovever I want the Image3 to be able to change depending on the value in the sheet.
Could some one help me.
I would really appriciate it
if the scheet have the value 3 the folowing should happen:
Variable = TextBox273 = ws2.Cells(24, 94).Value ('the value 3)
Image12.Picture = DetailSelect.Image3.Picture
Hovever I want the Image3 to be able to change depending on the value in the sheet.
Could some one help me.
I would really appriciate it





RE: changeing name variabels
CODE
Dim wksRefSheet As Worksheet 'Reference to the worksheet
Dim objTextBox As Object 'Reference to the desired textbox
Dim objMyImage As Image 'Reference to the desired image
Dim Value As Integer 'An integer to hold the value to check
Set wksRefSheet = Worksheets("sheet1")
Set objTextBox = wksRefSheet.OLEObjects("txtResult").Object
' OR you could use
'Set objTextBox = wksRefSheet.OLEObjects(1).Object
Set objMyImage = wksRefSheet.OLEObjects("imgMyImage").Object
With wksRefSheet
Value = Val(.Cells(3, 2))
objTextBox.Text = Value
Select Case Value
Case 1
objMyImage.Picture = (ChangeImage)
Case 2
objMyImage.Picture = (ChangeImage)
Case 3
objMyImage.Picture = (ChangeImage)
Case Else
End Select
End With
Set objMyImage = Nothing
Set objTextBox = Nothing
Set wksRefSheet = Nothing
End Sub
-JTBorton
Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]