Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Change format of a cell

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 reformate

'Add dashes when exiting textbo
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 confusio

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

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

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

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...
  #2   Report Post  
Posted to microsoft.public.excel.programming
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...



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Change format of a cell

Troy,

Horrible, but ...

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

---

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"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...



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Change format of a cell

That worked! Thanks a bunch!!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Change format of a cell

That worked! Thanks a bunch!!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lock Cell Format - Allow copy and paste of data without format change Chris12InKC Excel Worksheet Functions 2 May 9th 23 07:42 PM
Changing the cell format doesn't change existing cell content Kate Excel Discussion (Misc queries) 2 January 14th 10 04:44 PM
cant change the cell format it shows too many different cell form not able to make changes in sheet Excel Worksheet Functions 0 January 9th 07 04:16 AM
Can cell format come from and change with reference cell format jclouse Excel Discussion (Misc queries) 1 November 29th 06 03:20 AM
How do i change the format of a cell based on the condition of another cell in same row? scott23 Excel Programming 1 January 6th 04 03:03 PM


All times are GMT +1. The time now is 11:07 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"