Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Returning number and place in textbox

Returning number and place in textbox

Returning number and place in textbox

Please can someone tell me, I have a formula in cell d23 and the answer I would like to display in my textbox, but when I try to display it, the formula disappears or excel crashes.  If I use the source option under properties, it does not seem to work with a formula.  I wish to subtract two other cells which is sources of two other textboxes.

RE: Returning number and place in textbox

This is one piece of code I have written

Private Sub txtironmass_Change()
Dim x As range
    Set x = Worksheets("program").range("d23")
    ActiveCell.Formula = "=z-y"

End Sub

This is another piece of code I have tried.

Private Sub txtironmass_Change()
Dim myrange1 As range

Set myrange1 = Worksheets("program").range("d23")
If Cells("d22") > 0 Then
    ActiveCell.FormulaR1C1 = "=R[-1]C-R[-2]C"
 Else: range("d23").Select = 0
  End If
End Sub

Would this be more helpful

RE: Returning number and place in textbox

Sorry to be blunt, but it looks like you are very new to VBA. You should probably search the internet for some tutorials on VBA and Excel.  I can't tell from your explanation or your code what you are trying to do.

-handleman, CSWP (The new, easy test)

RE: Returning number and place in textbox

Try this. It doesn't require use of vba.

Display cell contents in a shape or text box
Click the AutoShape or text box you want to link.
In the formula bar, type an equal sign (=).
Click the worksheet cell that contains the data or text you want to link to.
You can also type the reference to the worksheet cell. Include the sheet name, followed by an exclamation point, for example:


Press ENTER.
Note  You cannot use this procedure in a freeform, scribble, line, or connector.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close