Thread: Textbox query
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Helmut Weber[_2_] Helmut Weber[_2_] is offline
external usenet poster
 
Posts: 163
Default Textbox query

Hi,

caption expects a string.

object.Caption [= String]

A textbox contains a string, not a number.

Private Sub CommandButton1_Click()
UserForm1.Caption = _
CStr(CLng(TextBox1.Value) + CLng(TextBox2.Value))
End Sub

HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

on strange territory

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"




Hi all

I am making a userform and I cant think how to get this to work. I am
trying to add textbox2 value to textbox3's ie 2 + 6 = 8

Here is the code I am using. Sorry I have a bit of brain fade.

TOTPEGS.Caption = TextBox2.Value + TextBox3.Value