Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
need to format from range E4 to E2003
numbers to be four characters if only three characters add a zero and a ' for hyperion to recognize any ideas anyone what I had Range("E4").Select Range(Selection, Selection.End(xlDown)).Select Z = Selection.Address 'get the address For Each X In ActiveSheet.Range(Z) 'Do while If Len(X) 0 Then 'Find cells with data X.FormulaR1C1 = Chr(39) & X.Text '39 is code for tick Else X.FormulaR1C1 = "" 'If empty do not put tick End If takes too long to format help |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not tested...
'-- Const strStart As String = "'" Const strFiller As String = "'0" Range("E4").Select Range(Selection, Selection.End(xlDown)).Select z = Selection.Address For Each x In ActiveSheet.Range(z).Cells If Len(x.Value) = 3 Then x.Value = strFiller & x.Value ElseIf Len(x.Value) = 4 Then x.Value = strStart & x.Value End If Next 'x '-- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) "JC" wrote in message need to format from range E4 to E2003 numbers to be four characters if only three characters add a zero and a ' for hyperion to recognize any ideas anyone what I had Range("E4").Select Range(Selection, Selection.End(xlDown)).Select Z = Selection.Address 'get the address For Each X In ActiveSheet.Range(Z) 'Do while If Len(X) 0 Then 'Find cells with data X.FormulaR1C1 = Chr(39) & X.Text '39 is code for tick Else X.FormulaR1C1 = "" 'If empty do not put tick End If takes too long to format help |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Also untested.... does this do what you want?
For Each x In ActiveSheet.Range("E4:E" & _ ActiveSheet.Cells(Rows.Count, "E").End(xlUp).Row) If Len(x.Text) = 3 Then x.Text = "'0" & Replace(x.Text, "'", "") ElseIf Len(x.Text) = 4 Then x.Text = "'" & Replace(x.Text, "'", "") Else x.Text = "" End If Next Rick "JC" wrote in message ... need to format from range E4 to E2003 numbers to be four characters if only three characters add a zero and a ' for hyperion to recognize any ideas anyone what I had Range("E4").Select Range(Selection, Selection.End(xlDown)).Select Z = Selection.Address 'get the address For Each X In ActiveSheet.Range(Z) 'Do while If Len(X) 0 Then 'Find cells with data X.FormulaR1C1 = Chr(39) & X.Text '39 is code for tick Else X.FormulaR1C1 = "" 'If empty do not put tick End If takes too long to format help |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Does the Zero need to be a leading Zero? Do they need to be treated as
numbers for calculation purposes or text (ie for coding) You could probably use a custom format to ensure that all cells are 4 numbers wide. I came across this problem many years ago and we were forced to use Lotus 123 as it allowed the download to be shown as text rather that a number. I would guess that updates within Excel would've now caught up. Let me know how you get on. "JC" wrote: need to format from range E4 to E2003 numbers to be four characters if only three characters add a zero and a ' for hyperion to recognize any ideas anyone what I had Range("E4").Select Range(Selection, Selection.End(xlDown)).Select Z = Selection.Address 'get the address For Each X In ActiveSheet.Range(Z) 'Do while If Len(X) 0 Then 'Find cells with data X.FormulaR1C1 = Chr(39) & X.Text '39 is code for tick Else X.FormulaR1C1 = "" 'If empty do not put tick End If takes too long to format help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
actual row number | Excel Worksheet Functions | |||
Formatting Number - Is there any way I can the actual value instea | Excel Discussion (Misc queries) | |||
retain formatting as an actual value | Excel Worksheet Functions | |||
How do I view all data in a cell regardless of number of characte. | Excel Discussion (Misc queries) | |||
How do I view the actual numeric value of a formula in Excel 2002. | Excel Worksheet Functions |