Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Art Ferdinand
 
Posts: n/a
Default Need VBA code to enter text into a textbox !!!!

Does anybody know one line of code that will allow me to
enter a number into a textbox on a worksheet.

when I record a macro I get..

Sheets("venn").Select
ActiveSheet.Shapes("Text Box 27").Select
Selection.Characters.Text = "123"

I thought this implies I could code this like so...

Dim sht as sheet
set sht = activesheet.shapes("Text Box 27")
sht.characters.text = "123"
set sht = nothing

But this does not work !! what is the correct way of
doing this ?

  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

How about:

Option Explicit
Sub testme()

Dim sht As Worksheet
Dim TBox As TextBox

Set sht = ActiveSheet
Set TBox = sht.TextBoxes("Text Box 27")

TBox.Characters.Text = "123"

Set sht = Nothing
Set TBox = Nothing

End Sub



Art Ferdinand wrote:

Does anybody know one line of code that will allow me to
enter a number into a textbox on a worksheet.

when I record a macro I get..

Sheets("venn").Select
ActiveSheet.Shapes("Text Box 27").Select
Selection.Characters.Text = "123"

I thought this implies I could code this like so...

Dim sht as sheet
set sht = activesheet.shapes("Text Box 27")
sht.characters.text = "123"
set sht = nothing

But this does not work !! what is the correct way of
doing this ?


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 7 March 7th 05 06:29 PM
Autofitting a row Josephine Excel Discussion (Misc queries) 2 March 3rd 05 03:37 PM
Error trapped only while stepping through the code - Not triggered when run Jeff Excel Discussion (Misc queries) 0 February 28th 05 06:26 PM
excel - numbers as text Thuferhawat New Users to Excel 12 January 24th 05 09:29 PM
Is there a way I can enter a letter to proceed text a column of ce Gordon Excel Discussion (Misc queries) 3 December 13th 04 07:13 PM


All times are GMT +1. The time now is 07:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"