userform textbox to variable

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

All Excel brains out there,

I am trying to save a textbox value as a variable and then use that
variable in a seperate module. So far everything that I have tried has
not worked, so does any one have any ideas?

Thanks,

Peter
 
It is ReturnValue = MyMessagebox.text.

You can also use a MSGBOX. Below is the VBA help suggestions

Text Property
See AlsoApplies ToExampleSpecificsReturns or sets the text for the specified
object. Read-only String for the Range object, read/write String for all
other objects.

For information about using the Text worksheet function in Visual Basic, see
Using Worksheet Functions in Visual Basic.

Remarks
For the Phonetic object, this property returns or sets its phonetic text.
You cannot set this property to Null.

Example
This example sets the text for the chart title of Chart1.

With Charts("Chart1")
.HasTitle = True
.ChartTitle.Text = "First Quarter Sales"
End With

This example sets the axis title text for the category axis in Chart1.

With Charts("Chart1").Axes(xlCategory)
.HasTitle = True
.AxisTitle.Text = "Month"
End With

This example illustrates the difference between the Text and Value
properties of cells that contain formatted numbers.

Set c = Worksheets("Sheet1").Range("B14")
c.Value = 1198.3
c.NumberFormat = "$#,##0_);($#,##0)"
MsgBox c.Value
MsgBox c.Text
 

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