LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Convert numbers to text

Hello all,

I am trying to program a checkbox such that when its value is True, a range
of numbers is brought in from another sheet. There are a bunch of
checkboxes, and the total of the data pulled in is summed using the =SUM
function.

When the checkbox value is false, I want the numbers to stay there, but to
be converted to text so that they are not added up in the =SUM function. I
will also want them to be grayed out, but that I can do easily.

I'm having trouble with converting the numbers to text, because I can't get
them to format the exact same way. I want parentheses for negative numbers,
a dollar sign, and no decimals. When I use quotation marks inside the =TEXT
function, I get a syntax error. What am I doing wrong?

My code is:

If CheckBox1.Value = True Then
Sheets("Sheet1").Range("E7:L7").Value =
Sheets("Sheet2").Range("F16:M16").Value
Else
Sheets("Sheet1").Range("E7").Formula = _
"=Text(Sheet2!F16," _($* #,##0_);_($* (#,##0)")"
Sheets("Sheet1").Range("F7").Formula = _
"=Text(Sheet2!G16, " _($* #,##0_);_($* (#,##0)")"
Sheets("Sheet1").Range("G7").Formula = _
"=Text(Sheet2!H16, " _($* #,##0_);_($* (#,##0)")"
Sheets("Sheet1").Range("H7").Formula = _
"=Text(Sheet2!I16, " _($* #,##0_);_($* (#,##0)")"
Sheets("Sheet1").Range("I7").Formula = _
"=Text(Sheet2!J16, " _($* #,##0_);_($* (#,##0)")"
Sheets("Sheet1").Range("K7").Formula = _
"=Text(Sheet2!L16, " _($* #,##0_);_($* (#,##0)")"
Sheets("Sheet1").Range("L7").Formula = _
"=Text(Sheet2!M16, " _($* #,##0_);_($* (#,##0)")"
End If

 
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
Convert numbers stored as text to numbers Stig - tame racing driver Excel Discussion (Misc queries) 5 November 14th 08 10:10 AM
Convert numbers stored as text to numbers Excel 2000 Darlene Excel Discussion (Misc queries) 6 January 31st 06 08:04 PM
How do I convert numbers stored as text with spaces to numbers Baffuor Excel Discussion (Misc queries) 1 May 24th 05 07:39 AM
How to convert Excel imported numbers from text to numbers? Alden Excel Discussion (Misc queries) 9 April 1st 05 09:51 PM
Convert Text Formated Numbers into Numbers all in VBA Marston Excel Programming 3 August 6th 04 06:55 PM


All times are GMT +1. The time now is 06:59 PM.

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

About Us

"It's about Microsoft Excel"