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

Hi all

Using VB, I created a new sheet.
I would like to format a certain column so when my VB program put numerical
values starting with zero, the zero would stay.
Example: "01234" should read "01234" when the file is opened with Excel.
At the moment when I open the file with Excel, the reading is "1234" (the
leading zero is omitted)

Maybe I should format the column as "Text"
How do I do that please?

TIA
Guy



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Formatting a cell

One way is to do the following:


[Object.]Cells(2,1).value = "'" & 01234.

If you need to use the value for some other calculation do
this:


X = Val([Object.]Cells(2,1).value ) * 24

Val([Object.]Range("B15").value ) = Val([Object.]Cells
(2,1).value ) * 24

note: If the cell you are getting data from is on
the "activesheet" you do not need the [Object.].



-----Original Message-----
Hi all

Using VB, I created a new sheet.
I would like to format a certain column so when my VB

program put numerical
values starting with zero, the zero would stay.
Example: "01234" should read "01234" when the file is

opened with Excel.
At the moment when I open the file with Excel, the

reading is "1234" (the
leading zero is omitted)

Maybe I should format the column as "Text"
How do I do that please?

TIA
Guy



.

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
Conditional formatting--different formatting depending on cell con Tammy S. Excel Discussion (Misc queries) 3 March 30th 09 08:11 PM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 0 January 15th 07 04:35 PM
expanding custom formatting without removing existing cell formatting? Keith Excel Worksheet Functions 3 December 27th 06 01:54 PM


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