PC Review


Reply
Thread Tools Rate Thread

Change cell type

 
 
Derick
Guest
Posts: n/a
 
      8th Aug 2011
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
 
Reply With Quote
 
 
 
 
Vacuum Sealed
Guest
Posts: n/a
 
      8th Aug 2011
Derick

Try

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

HTH
Mick.


 
Reply With Quote
 
Jim Rech
Guest
Posts: n/a
 
      8th Aug 2011
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" <(E-Mail Removed)> wrote in message
news:d2416dfd-ace4-4ec2-bd3d-(E-Mail Removed)...
> 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


 
Reply With Quote
 
GS
Guest
Posts: n/a
 
      8th Aug 2011
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


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 Microsoft Excel Worksheet Functions 3 25th May 2008 10:29 PM
Change cell reference type =?Utf-8?B?TGFkeW11Y2s=?= Microsoft Excel Programming 5 24th Sep 2007 04:08 PM
How do I type in colour without having to change it every cell =?Utf-8?B?SnVtaWNsYWRz?= Microsoft Excel Misc 2 15th Mar 2007 04:48 PM
Change Cell Value Across whole WorkSheet/ Workbook if cell type is currency Shashi Bhosale Microsoft Excel Programming 1 11th Oct 2004 03:20 PM
How to change type of the cell? Anton Microsoft Excel Programming 1 31st Oct 2003 12:42 PM


Features
 

Advertising
 

Newsgroups
 


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