when change value of cell

  • Thread starter Thread starter tpapaj
  • Start date Start date
T

tpapaj

Hi,
can someone please help me?

I need to program this:

When I Change value in cell A1 from
"en" to "cz"
Implicit value is "en"
the Caption of Button1 change from
"English" to "Czech"
How to do it please?

Tom
 
Hi Tom,

One way

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1")) Is Nothing Then
With Target
If LCase(.Value) = "en" Then
Me.Shapes("Button 1").Select
Selection.Characters.Text = "English"
ElseIf LCase(.Value) = "cz" Then
Me.Shapes("Button 1").Select
Selection.Characters.Text = "Czech"
End If
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

This is worksheet event code, so right-click the sheet tab, select View Code
from the menu, and paste it in.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
In Your project window go to ThisWorkbook. In the top of code window: Left dropdown choose Workbook, Right dropdown choose SheetChange then add this code

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) "this is generated for you

If Target.Address = "$A$1" The
Select Case UCase(Target
Case "CZ
ActiveSheet.OLEObjects("Button1").Object.Caption = "Cz
Case "EN
ActiveSheet.OLEObjects("Button1").Object.Caption = "En
End Selec
End I

End Sub "this is generated for you


----- tpapaj > wrote: ----

Hi
can someone please help me

I need to program this

When I Change value in cell A1 from
"en" to "cz
Implicit value is "en
the Caption of Button1 change fro
"English" to "Czech
How to do it please

To
 
I think these are forms buttons judging by the button name.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

chris said:
In Your project window go to ThisWorkbook. In the top of code window: Left
dropdown choose Workbook, Right dropdown choose SheetChange then add this
code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range) "this is generated for you"
 

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

Back
Top