How can i change the cell format in a range using a macro?

  • Thread starter Thread starter Alvaro G?lvez
  • Start date Start date
A

Alvaro G?lvez

Hi:

I need to change the cell format in a specific range using a macro.
I insert into this range a lot of values and excel change the cell
format automatic, changing it from General to numeric or something
else. I need this range always behave as text. Is there anything like
Worksheets(xxx).range(x, y).type = text ??

Thanks! :-)
 
Sub TextFormat()
Selection.NumberFormat = "@"
End Sub

Or in Workbook_Open

WorkSheets("Sheet1").Range("A1:H34").NumberFormat = "@"

Gord Dibben Excel MVP
 

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

Back
Top