ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding the Format of a Cell (https://www.excelbanter.com/excel-programming/358813-finding-format-cell.html)

GusEvans

Finding the Format of a Cell
 
Have a large dynamically populated worksheet (from another application).
Some cells are date formats, currency, text, etc. I need allof the cells to
be formatted as text without losing their 'look and feel'. I can't use
=Cell("Format",A1) in VBA and can't find any equivalent. On dates I could
say the equivalent of -
If '=Cell("Format",A1)' = "D4" Then Format(Activecell.Value,"m/d/yy")

Any Ideas?
TIA-
--
Gus Evans

Martin

Finding the Format of a Cell
 
if you use a Variant variable (which I guess you must), you can use the
TypeName property (see VBA help)

"GusEvans" wrote:

Have a large dynamically populated worksheet (from another application).
Some cells are date formats, currency, text, etc. I need allof the cells to
be formatted as text without losing their 'look and feel'. I can't use
=Cell("Format",A1) in VBA and can't find any equivalent. On dates I could
say the equivalent of -
If '=Cell("Format",A1)' = "D4" Then Format(Activecell.Value,"m/d/yy")

Any Ideas?
TIA-
--
Gus Evans


GusEvans

Finding the Format of a Cell
 
Thanks - worked like a charm.
--
Gus Evans


"Martin" wrote:

if you use a Variant variable (which I guess you must), you can use the
TypeName property (see VBA help)

"GusEvans" wrote:

Have a large dynamically populated worksheet (from another application).
Some cells are date formats, currency, text, etc. I need allof the cells to
be formatted as text without losing their 'look and feel'. I can't use
=Cell("Format",A1) in VBA and can't find any equivalent. On dates I could
say the equivalent of -
If '=Cell("Format",A1)' = "D4" Then Format(Activecell.Value,"m/d/yy")

Any Ideas?
TIA-
--
Gus Evans



All times are GMT +1. The time now is 08:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com