Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

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

big help with adding numbers to one cell 1

Status
Not open for further replies.

Luis939

MIS
Feb 28, 2003
453
US
now i know this might be impossible, but my macro adds many numbers to one cell, but unlike adding those same numbers manually, you cant see the formula in the formula, is there anyway of having it so that after my numbers are populated you can see it as a formula so that after i execute
activecell.value = 1
activecell.value = activecell.value + 5

i can see = 5+1

instead of 6 in the formula bar?? thanks!!!
 
[blue]
Code:
Sub AppendANumber(ANumber As Integer)
  If ActiveCell.HasFormula Then
    ActiveCell.Formula = ActiveCell.Formula & "+" & ANumber
  Else
    If IsEmpty(ActiveCell) Then
      ActiveCell = ANumber
    Else
      ActiveCell.Formula = "=" & ActiveCell.Value & "+" & ANumber
    End If
  End If
End Sub
[/color]

Test it by running this two or three times:
[blue]
Code:
Sub test()
  AppendANumber (42)
End Sub
[/color]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top