Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MJ MJ is offline
external usenet poster
 
Posts: 1
Default VBA format cells


Hi...

I was wondering if there is a way for visual basic to pick
up an Excel cell's format properties like "Category"
(general, currency, percentage, etc.)

Also if the Category is set to "Number", can VB pick up
the "Decimal places" property?

Any help? Thanks!

MJ
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default VBA format cells

Hi
have a look at the numberformat property of the range object

--
Regards
Frank Kabel
Frankfurt, Germany


MJ wrote:
Hi...

I was wondering if there is a way for visual basic to pick
up an Excel cell's format properties like "Category"
(general, currency, percentage, etc.)

Also if the Category is set to "Number", can VB pick up
the "Decimal places" property?

Any help? Thanks!

MJ

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 64
Default VBA format cells

MJ,

Activecell.numberformat will give you this in the same way
that you would define it, or in the same way it shows in
the "custom" section of the FormatNumber dialogue box.

For example, format a cell to normal number format to two
decimal places. In the immediate window, type:
?Activecell.Numberformat

it should return "0.00". Change the format to four decimal
places, check again and it will have changed to "0.0000".

That should get you started.

Cheers, Pete.

-----Original Message-----

Hi...

I was wondering if there is a way for visual basic to

pick
up an Excel cell's format properties like "Category"
(general, currency, percentage, etc.)

Also if the Category is set to "Number", can VB pick up
the "Decimal places" property?

Any help? Thanks!

MJ
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
MJ MJ is offline
external usenet poster
 
Posts: 2
Default VBA format cells


That satisfies my needs... thanks guys!

MJ


-----Original Message-----
MJ,

Activecell.numberformat will give you this in the same

way
that you would define it, or in the same way it shows in
the "custom" section of the FormatNumber dialogue box.

For example, format a cell to normal number format to two
decimal places. In the immediate window, type:
?Activecell.Numberformat

it should return "0.00". Change the format to four

decimal
places, check again and it will have changed to "0.0000".

That should get you started.

Cheers, Pete.

-----Original Message-----

Hi...

I was wondering if there is a way for visual basic to

pick
up an Excel cell's format properties like "Category"
(general, currency, percentage, etc.)

Also if the Category is set to "Number", can VB pick up
the "Decimal places" property?

Any help? Thanks!

MJ
.

.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA format cells

MsgBox (ActiveSheet.Range("A1").NumberFormat)


---
Message posted from http://www.ExcelForum.com/



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
How to format cells in Excel 2007 (i.e. currency format)? DonR Excel Discussion (Misc queries) 2 May 25th 08 11:16 PM
How do I format cells to show date in Australian not US format? Kevin B[_2_] Excel Worksheet Functions 1 May 12th 08 04:17 AM
how do i format a cell based on format of a range of cells? Chris Hardick Excel Discussion (Misc queries) 2 April 3rd 06 08:54 AM
want format cells alignment not format cells font style Jeannie Bean Excel Discussion (Misc queries) 2 February 10th 06 09:31 AM
Cells won't convert to number format, even after format/cells/num. scottr Excel Discussion (Misc queries) 5 April 12th 05 11:02 PM


All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"