PDA

View Full Version : [SOLVED:] Insert text into textbox



av8tordude
03-07-2011, 01:38 PM
i have a textbox located on a sheet (Named: Version). Each time A1 is updated with a new number, I have to change the text in the textbox also. Can someone assist me with a macro that will automatically change the text in the textbox to the value in cell A1.

Thanks for you help

mancubus
03-07-2011, 02:26 PM
goes to Textbox1's worksheet module


Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$A$1" Then Exit Sub
Worksheets("Sheet1").TextBox1.Value = Range("A1").Value
End Sub

av8tordude
03-07-2011, 02:44 PM
Hi Mancubus

The textbox is not like a userform textbox. The box, named: Label 3156, was inserted via the Developer - Insert - forms control. It looks like a label

mancubus
03-07-2011, 03:26 PM
the code is for worksheet textbox not UF textbox.

if it is a worksheet label (forms control) then


Private Sub Worksheet_Change(ByVal Target As Range)
Worksheets("Sheet1").Shapes("Label 3156").TextFrame.Characters.Text = Range("A1").Text
End Sub

av8tordude
03-07-2011, 04:49 PM
Mancubus,

After frying my brains out, stopping short of chucking my computer out the window :igiveup:, I could not understand why your code was not working. Suddenly I had an epiphany. Check to make sure I was in Design Mode. Sure enough I was.:rotlaugh:

Thank you.:beerchug: :beerchug: :beerchug:

mancubus
03-08-2011, 02:44 AM
wellcome.



ps: not a shame. :)
many (including myself) do the same mistake oftenly. :whistle: