I'd like to add a suffix...

G

Guest

I would like to add a suffix <<< "hrs" >>>to some fields. The fields are the
result of Formulas <<< "=SUM(C11:C42)" >>> I would like the field to be
displayed as the resultant number (49) & the desired text (hrs) = 49 hrs.

Is there a means to do this?
 
E

Earl Kiosterud

Dr.,

Probably the best way to add your suffix is with the number formatting of
the cell. With the cells selected, Format - Cells - Number - Custom.
append the following to whatever is in the box:

" hrs"

If there are semicolons in the current formatting stuff, put the above in
front of each semicolon, as well as at the end. If this doesn't work, post
back with the current formatting code, and we'll go from there.

With this method, your total remains a number, which can be used by other
formulas if needed.
 
D

Don Guillett

try this
Sub addsuffix()
For Each c In Selection
'to leave formula and add suffix
If Left(c.Formula, 1) = "=" Then c.Formula = c.Formula & "&" & """ hrs"""
'or this line to leave the value only
'If Left(c.Formula, 1) = "=" Then c.Value = c & " hrs"
Next
End Sub
 

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

Top