Excel2000: Formatting a range as Text in VBA

A

Arvi Laanemets

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!
 
N

Norman Jones

Hi Arvi,

To format as general:

Selection.NumberFormat = "General"

To format as text:

Selection.NumberFormat = "@"
 
A

Arvi Laanemets

Thanks!


--
Arvi Laanemets
( My real mail address: arvil<at>tarkon.ee )



Norman Jones said:
Hi Arvi,

To format as general:

Selection.NumberFormat = "General"

To format as text:

Selection.NumberFormat = "@"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top