Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Increase/decrease decimal by programming

Hello,

I'd like to increase/decrease decimal by programming in Excel. I'd
like to do this, in the column A. At position 20 of this column, I
have the number of decimal I want for the column A and for the row
above 20 except row 1 and 2.

For information this Excel file is fill in by .NET application, I use
a template. I have a specific row for the number of decimal.

Regards,

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Increase/decrease decimal by programming

Try something like

Dim NumDecPlaces As Long
Dim NumFormat As String
NumDecPlaces = Range("B1").Value
NumFormat = "0." & String$(NumDecPlaces, "0") & ";-0." & "0." & _
String$(NumDecPlaces, "0") & ";@"
Range("A1").NumberFormat = NumFormat

This will format A1 with the number of decimal places specified in cell B1.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


wrote in message
oups.com...
set the numberformat property.
in VBA (as an example) it would be
Range("A20").Numberformat = "#,###.000"
for 3 decimals.


Thanks Tom but the number of decimal is not all the time 3 but depends
of a value placed in a specific cell, the number of decimal is the
same for all the column above. Then the number of decimal is column
depending.

Regards,



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
Increase & Decrease Decimal Place Aaron Excel Worksheet Functions 6 December 9th 08 01:27 AM
increase/decrease decimal cbfinancial Excel Worksheet Functions 2 April 10th 06 10:43 PM
% of increase or decrease Neil R Excel Discussion (Misc queries) 9 November 27th 05 03:13 AM
Increase / decrease decimal - retain cell formatting kbellendir Excel Programming 3 October 28th 04 11:09 PM
Increase/decrease decimal code Chris Excel Programming 3 November 19th 03 08:50 PM


All times are GMT +1. The time now is 02:40 AM.

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"