View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dnereb[_21_] Dnereb[_21_] is offline
external usenet poster
 
Posts: 1
Default Referring to a TextBox


You have to set F1 to the complete textbox not to a part of it


Code:
--------------------
Sub TestLoad()
Dim F1 As TextBox
Set F1= TextBox2
ActiveSheet.EditBox.Text = ActiveSheet.F1.Text
End Sub
--------------------


but you want to select wich textbox to select on the run so you need to
use a control. I'm assuming you are placing this code in a form...


Code:
--------------------
Sub TestLoad()
Dim Ct as Control
Dim F1 As TextBox

for each Ct in Me.Controls
if Ct.name = "Textbox" & YourNumber then
Set F1= Ct
exit for
end if
next
ActiveSheet.EditBox.Text = ActiveSheet.F1.Text
End Sub
--------------------


--
Dnereb
------------------------------------------------------------------------
Dnereb's Profile: http://www.excelforum.com/member.php...o&userid=26182
View this thread: http://www.excelforum.com/showthread...hreadid=398086