View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Insert a quote mark, then repeat

ActiveSheet.Range("A1:A50").NumberFormat = "Text"
should be:
ActiveSheet.Range("A1:A50").NumberFormat = "@"

But this doesn't change the underlying values from numbers to text. You'd still
need to convert them some way (looping through the cells or data|text to
columns???).

JLGWhiz wrote:

If by labels you mean text, then the easy way is just to fromate the entire
range as text. You numbers will still look like numbers but will have a
string data type. You can do that from the menu by first selecting the
range you want to format, the click FormatCellsTextOK. You can also use
in VBA:

ActiveSheet.Range("A1:A50").NumberFormat = "Text"

If it is necessary to change the format while the code is running. You can
specify any size range with code up to the entire sheet.

"sam" wrote:

Hi -

This used to be so easy in Lotus!

I want to convert values to labels in a column of 50 cells. Best way to do
so is to insert a quote mark at the beginning of every cell. Attempted to
create a relative macro to do so by: F2 (edit) R1C1\Home\' \Stop. Assigned it
Control Q. Since I have no clue how to make a macro repeat (downwards), I
thought I would just arrow down to the next cell manually, and then Control Q.

All this "brilliant" macro did was copy the contents of R1C1 to R2C1.

I miss Lotus. Sigh..

Thanks to anyone who helps! Tried to search this, BTW.

sam


--

Dave Peterson