Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Change cell type

Hi

I am using C# to try and format a range in Excel as numbers. When
doing this, I get the green error arrow in the corner to ask me if I
want to format the column as a number.

I used the code below to format the data:

Excel.Range Data = currentSheet.get_Range("K2:K10", Type.Missing);
Data.NumberFormat = "0.00";

How do I convert the range to numbers so that excel is happy?

Thanks
Derick
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 259
Default Change cell type

Derick

Try

Range("K2:K10").Select
Selction.NumberFormat= "0.00"

HTH
Mick.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default Change cell type

Excel isn't really unhappy. It's just that the optional error checking
feature is pointing out some possible inconsistency. The green markers do
no harm but if you want to turn them off it can be done on the Formulas tab
of Excel Options (Excel 2007 and 2010).


"Derick" wrote in message
...
Hi

I am using C# to try and format a range in Excel as numbers. When
doing this, I get the green error arrow in the corner to ask me if I
want to format the column as a number.

I used the code below to format the data:

Excel.Range Data = currentSheet.get_Range("K2:K10", Type.Missing);
Data.NumberFormat = "0.00";

How do I convert the range to numbers so that excel is happy?

Thanks
Derick


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Change cell type

Vacuum Sealed has brought this to us :
Derick

Try

Range("K2:K10").Select
Selction.NumberFormat= "0.00"

HTH
Mick.


Mick,
Since NumberFormat is a read/write property of the Range object, there
is no need to select it. (Unecessary selecting slows down code
performance)

Range("K2:K10").NumberFormat = "0.00"

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


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
Trying to change the background of a cell if I type a certain wor T-DOGG01 Excel Worksheet Functions 3 May 25th 08 10:29 PM
How do you change the data type of a cell using VBA? justme0010 New Users to Excel 2 January 14th 08 02:38 PM
Change cell reference type Ladymuck Excel Programming 5 September 24th 07 04:08 PM
Change Cell Value Across whole WorkSheet/ Workbook if cell type is currency Shashi Bhosale Excel Programming 1 October 11th 04 03:20 PM
How to change type of the cell? Anton[_3_] Excel Programming 1 October 31st 03 12:42 PM


All times are GMT +1. The time now is 10:01 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"