Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

changeing name variabels

changeing name variabels

changeing name variabels

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

RE: changeing name variabels

I'm not entirely sure what you are trying to accomplish, but hopefully this will point you in the right direction.  I renamed the text box on the worksheet to a more descriptive name.  I suggest you do the same if you have several objects on a form.


Sub CheckValue()

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

Well, You can try banging your head against the wall, but you just end up with lost-time injuries and damaged equipment. [M. Passman]

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close