View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Change format of a cell

.Cells(NxtRow, 1).NumberFormat = "General"
.Cells(NxtRow, 1) = "'" & Data_Frm.MRN_TxBx.Value

--
Regards,
Tom Ogilvy


"Troy" wrote in message
...
I am having problems formatting a cell when sending a value from a

textbox. Here is a part of what is being done.
A User will enter a series of numbers into a textbox. When they exit the

textbox, the value is reformated

'Add dashes when exiting textbox
MRN_TxBx.Value = Format(MRN_TxBx.Value, "#00-00-00")

If the user decides to re-enter the textbox, it removes the dashes to

avoid any confusion

'Remove all dashes when entering textbox
MRN_TxBx.Value = Replace(MRN_TxBx.Value, "-", "")

When all is done, I copy the value to a cell with the following:

'Format cell & add value
.Cells(NxtRow, 1).NumberFormat = "General"
.Cells(NxtRow, 1) = Data_Frm.MRN_TxBx.Value

When I check the cell with the value, the format of the cell is always a

date. I don't want a date format, I need it to be general or text. Any
ideas?

Thanks...