Quote:
Originally Posted by IlliniLou
Is there a way to convert cells with amounts such as 1089.56 to be formatted into 108956?? And then is there a way to save these excel files into a notepad file where there won't be spaces between the cells??
If you want a VBA procedure that checks a complete range and removes
decimal points from all cells within that range then this will do it.
Open Excel and press Alt+F11 to open the VBA editor.
Click Insert > Module
Copy and paste the following:
Code:
Sub DeleteDecimalPoint()
'Purpose: Checks each cell's value for a decimal point in a given
'range and removes it if found. If no deimal point is found,the
'cell value is left unchanged. This procedure runs on the currently
'active worksheet.
'Remarks: Change the range rData to fit your needs. So if the range
'storing your data is B1 through J1000, change the "Set rData" statement to:
'Set rData = Range("B1:J1000").
'This procedure looks for and removes exactly one decimal point. If any cell
'contains more than one decimal point then run it more than once.
'*********************************************************
Dim oDecPoint As Object
Dim rData As Range
Dim rCell As Range
Dim WSF As WorksheetFunction
'********************************************************
Set rData = Range("A1:B5") 'Change this range as needed.
Set WSF = WorksheetFunction
On Error Resume Next
With ActiveSheet
For Each rCell In rData
With WSF
oDecPoint = .IsNumber(.Find(".", rCell))
If oDecPoint = True Then
rCell = .Replace(rCell, .Find(".", rCell), 1, "")
Else
'Continue looping until all cells are checked.
End If
End With
Next rCell
End With
End Sub
To run this procedure:
Press Alt+F11 to return to Excel worksheet.
Click Tools> Macro > Macros
Double click on RemoveDecimalPoint
Last edited by SMA775; 11-04-2011 at 09:02 PM.
Reason: Spelling