View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
witek witek is offline
external usenet poster
 
Posts: 69
Default Force a cell to display as Text

1. Open excel, go to tools/Macro/Record new Macro.

2. Do, what you want to do with Excel, i.e. change cell formating to text.
3. Go to tools/Macro/Stop recording
4. Click Alt-F11 to open VB Editor
5. Find your project and usualy Module1 module.
6. Look at the code generated by macro recorder.

you will find:

Sub Macro1()
Selection.NumberFormat = "@"
End Sub


Now, you know how people know what to put as number format. :)




Julie wrote:
The "@" symbol worked. Thanks.

I don't understand what you mean by "recording a macro within excel". I
really haven't done any macros in Excel, nor any VBA. I've only programmed in
.NET C#, using Visual Studio Tools For Office.

"Dave Peterson" wrote:


myRange.numberformat = "@"

Sometimes you can get the answer by recording a macro within excel.