Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am running code to check through each column in a worksheet and make
substitutions for various characters, e.g. For i = 1 To numcols For j = 1 To numrows - 1 fvalue = ActiveCell.Offset(j, 0) Call cleanse_data ActiveCell.Offset(j, 0).Value = StrConv(fvalue, vbUpperCase) Next Sub cleanse_data() 'data cleansing routine fvalue = Application.WorksheetFunction.Substitute (fvalue, "&", " AND ") fvalue = Application.WorksheetFunction.Substitute (fvalue, "#", " NO. ") fvalue = Application.WorksheetFunction.Substitute (fvalue, "/", " ") fvalue = Application.WorksheetFunction.Substitute (fvalue, "/", " ") fvalue = Application.WorksheetFunction.Substitute (fvalue, "_", " ") fvalue = Application.WorksheetFunction.Substitute (fvalue, " ", " ") fvalue = Application.WorksheetFunction.Substitute (fvalue, " ", " ") End sub my problem is that when the value is written back into the cell "numbers" which were previously formatted as text revert to a number format, e.g. "000888" reverts to "888". How can I run this code, or similar code and retain the original formatting? I can't use a leading apostraphe as these values are uploaded to database system. Would appreciate any input ... Julie |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
numbers formatted as text | Excel Discussion (Misc queries) | |||
a code to trace pure numbers formatted as Text | Excel Programming | |||
formatted numbers to CSV problem | Excel Programming | |||
Pivot Table keep apart cells text that I've formatted as numbers | Excel Worksheet Functions | |||
Converting numbers formatted as text to numbers | Excel Discussion (Misc queries) |