ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel2000: Formatting a range as Text in VBA (https://www.excelbanter.com/excel-programming/344252-excel2000-formatting-range-text-vba.html)

Arvi Laanemets

Excel2000: Formatting a range as Text in VBA
 
Hi

To format a range as General in VBA I use a code row like this:
....
ThisWorkbook.Sheets("Forecast").Range("A1").Offset (k, 2).NumberFormat = "@"

I have searche desperately for it, but I didn't find a way to set the range
to be formatted as Text (i.e. after the VBA formats the range, cell format
shows it formatted as Text). I tried to record a macro when formatting the
range as text manually, but all I did get back, was the same code for
setting format to General

Thanks in advance for your help!

--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )



Norman Jones

Excel2000: Formatting a range as Text in VBA
 
Hi Arvi,

To format as general:

Selection.NumberFormat = "General"

To format as text:

Selection.NumberFormat = "@"

---
Regards,
Norman



"Arvi Laanemets" wrote in message
...
Hi

To format a range as General in VBA I use a code row like this:
...
ThisWorkbook.Sheets("Forecast").Range("A1").Offset (k, 2).NumberFormat =
"@"

I have searche desperately for it, but I didn't find a way to set the
range to be formatted as Text (i.e. after the VBA formats the range, cell
format shows it formatted as Text). I tried to record a macro when
formatting the range as text manually, but all I did get back, was the
same code for setting format to General

Thanks in advance for your help!

--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )




Arvi Laanemets

Excel2000: Formatting a range as Text in VBA
 
Thanks!


--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )



"Norman Jones" wrote in message
...
Hi Arvi,

To format as general:

Selection.NumberFormat = "General"

To format as text:

Selection.NumberFormat = "@"

---
Regards,
Norman



"Arvi Laanemets" wrote in message
...
Hi

To format a range as General in VBA I use a code row like this:
...
ThisWorkbook.Sheets("Forecast").Range("A1").Offset (k, 2).NumberFormat =
"@"

I have searche desperately for it, but I didn't find a way to set the
range to be formatted as Text (i.e. after the VBA formats the range, cell
format shows it formatted as Text). I tried to record a macro when
formatting the range as text manually, but all I did get back, was the
same code for setting format to General

Thanks in advance for your help!

--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )







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

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