if x = true then do y, possible?

  • Thread starter Thread starter MarcB
  • Start date Start date
M

MarcB

I'm sure this is possible, just not sure how I should go about it.
have a drop-down list with a bunch of values and an "other" value. I
the user selects other I would like a image to be inserted on anothe
worksheet in a field. If any value is selected I would like a simpl
text line to be inserted in the same area on the other worksheet.

How would I go about this? Should I code this in VBA or can it b
included in some sort of cell formula?

Thank you
 
try this vba code

Dim t As String
Private Sub ComboBox1_Change()

Dim pic As Object


If ComboBox1.Value = "other" Then
Sheets("Sheet2").Select
ActiveSheet.Range("C6").Select
ActiveSheet.Range("C6").Value = ""
Set pic = ActiveSheet.Pictures.Insert( _
"C:\Documents and Settings\Administrator\My Documents\M
Pictures\rxvpheader.gif")
pic.Width = ActiveSheet.Range("C6").Width
pic.Height = ActiveSheet.Range("C6").Height
pic.Left = ActiveSheet.Range("C6").Left
pic.Top = ActiveSheet.Range("C6").Top
t = pic.Name
Application.CommandBars("Picture").Visible = False

Else
Sheets("Sheet2").Select
If t <> "" Then
ActiveSheet.Shapes(t).Select
ActiveSheet.Shapes(t).Delete
t = ""
End If

ActiveSheet.Range("C6").Select


ActiveSheet.Range("C6").Value = ""
ActiveSheet.Range("C6").Value = "any text"
End If
End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top