![]() |
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 |
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 |
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 . |
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 . . |
VBA format cells
|
All times are GMT +1. The time now is 04:13 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com