Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning number and place in textbox

Status
Not open for further replies.

metal24

Materials
Oct 10, 2006
3
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.
 
Replies continue below

Recommended for you

Don't you think that showing your code would help here?

TTFN

FAQ731-376
 
This is one piece of code I have written

Private Sub txtironmass_Change()
Dim x As range
Set x = Worksheets("program").range("d23")
x.Select
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
myrange1("D23").Select
ActiveCell.FormulaR1C1 = "=R[-1]C-R[-2]C"
Else: range("d23").Select = 0
End If

End Sub

Would this be more helpful
 
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)
 
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:

Sheet1!F2

Press ENTER.
Note You cannot use this procedure in a freeform, scribble, line, or connector.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor