Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Macro to change a number to text

Hi Lori,

Al's suggestion should work to exlude the number from being included in the
SUM. Alternatively, the user could use a UDF instead of SUM:

Public Function SumIfNotBold(rng As Range) As Variant
Dim c As Range
Dim v As Variant

Application.Volatile

For Each c In rng
If Not c.Font.Bold And IsNumeric(c.Value) Then v = v + c.Value
Next c

SumIfNotBold = v
End Function

The SUM forumula can then be changed to =SumIfNotBold(<your range).

That way, if the user makes a number bold, it will not be included in the
total. This will update on each calculation of the worksheet.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Lori F. wrote:
Help, please?

I have a user who has a column of accts payable numbers
and a total at the bottom (=Sum). When a payment is made,
she wants to be able to bold a number and tell Excel not
to include it in the total at the bottom.

I've created a macro to bold the current cell and format
it as text instead of a number. The cell that is now text
should not be calculated the function, but it is. What am
I doing wrong?

Thanks!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to change a number to text

Jake,

Another great suggestion - thanks!

Lori

-----Original Message-----
Hi Lori,

Al's suggestion should work to exlude the number from

being included in the
SUM. Alternatively, the user could use a UDF instead of

SUM:

Public Function SumIfNotBold(rng As Range) As Variant
Dim c As Range
Dim v As Variant

Application.Volatile

For Each c In rng
If Not c.Font.Bold And IsNumeric(c.Value)

Then v = v + c.Value
Next c

SumIfNotBold = v
End Function

The SUM forumula can then be changed to =SumIfNotBold

(<your range).

That way, if the user makes a number bold, it will not be

included in the
total. This will update on each calculation of the

worksheet.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address

unmonitored]


Lori F. wrote:
Help, please?

I have a user who has a column of accts payable numbers
and a total at the bottom (=Sum). When a payment is

made,
she wants to be able to bold a number and tell Excel not
to include it in the total at the bottom.

I've created a macro to bold the current cell and format
it as text instead of a number. The cell that is now

text
should not be calculated the function, but it is. What

am
I doing wrong?

Thanks!


.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to change text into number? Eric Excel Discussion (Misc queries) 5 November 10th 07 05:43 PM
Formula to change scientific number to regular number or text Compare Values Excel Discussion (Misc queries) 2 August 23rd 07 06:10 PM
Change number format from text to number? Scot New Users to Excel 2 December 1st 05 04:15 PM
Change Text to a number jennifer Excel Worksheet Functions 1 April 27th 05 08:47 PM
EZ Q 4 U: How do I change a number to text, based on the number UCD GRAD Excel Worksheet Functions 2 November 9th 04 09:05 PM


All times are GMT +1. The time now is 08:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"