Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
Ŧ Groups Home
Message from discussion Number-format...
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dana DeLouis  
View profile  
 More options May 1 2000, 3:00 am
Newsgroups: microsoft.public.excel.misc
From: "Dana DeLouis" <da...@email.msn.com>
Date: 2000/05/01
Subject: Re: Number-format...
Hello.  I once used the following with Excel 2000
    rng = Format(rng)

However, Peter Surcouf suggested using CDbl a while ago here in the
newsgroups.
    rng = CDbl(rng)

The both do the same thing.  (ie changing 123- to -123, and not changing the
text "test-" to 0 (zero) as using the Val() function would do.)

However, CDbl appears to be faster, especially if the text is really text
that should not be converted to a negative number (ie a cell had "-not a
number-").  My guess is that Format() actually does its thing on each cell,
if it is text or a number.  It appears that CDbl can more quickly determine
if  the text can be converted.  If the data is actually text, it more
quickly moves on and does not bother doing the actual CDbl routine.  I am
not an expert, so this is only a guess.  Maybe someone can add to this idea.

Anyway, I use the following.  I use special cells to only look at text.  (no
need to waste time looking at numbers.)  I also do not want to look at
formulas.  If a Cell had the formula =1 / 3, then using CDbl on this cell
would change the cell to 0.33333333 by replacing the formula with the actual
value.  This is probably not what is wanted.  Anyway, just another idea to
consider.    Dana DeLouis

Sub TrailingMinus()
' = = = = = = = = = = = = = = = =
' General idea from Peter Surcouf
' = = = = = = = = = = = = = = = =
  Dim rng As Range
  Dim BigRng As Range

  On Error Resume Next
  Set BigRng = Cells.SpecialCells(xlConstants, xlTextValues).Cells
  If BigRng Is Nothing Then Exit Sub

  For Each rng In BigRng
    rng = CDbl(rng)
  Next

End Sub

"Lospanga" <lospa...@swipnet.se> wrote in message

news:3JYO4.14661$uJ1.31266@nntpserver.swip.net...
> I have a problem. I will try too write as good in english that I can.

> When I import data from a database to Excel  - all my negativ numbers is
> converting wrong. All my negative numbert - start with the number and
after
> the number the "negative-character" comes (ex 230-). This is my problem
> because Excel donīt think that my negative numbers are numbers, Excel
think
> that all my negative numbers are text. I want to write all negative
> numbert with the "negative-character" first (ex -230).
> Soo, if somebody know how to write something in VB, that searching for all
> the "negative-character" ( - ) and put the "negative-character" first in
all
> the cell, please help me.

> One more question.....

> Do somebody know who to make one cell "non-printing". I want to see the
> information on the screen but I donīt want the information when I print.

> Madeleine


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.