L
lauralucas
hello
I'm currently using this macro for converting a column that has mixed
types (text and numeric) and change it to being text.
Sub AddSpace()
Dim r As Range
Dim Wks As Worksheet
Dim cell As Object
Dim found As Boolean
For IndexSheet = 1 To Sheets.Count
Set Wks = Sheets(IndexSheet)
With Wks
.Activate
'find the column that has to be changed
found = False
For Each r In .Range("1:1")
If r.Value2 = "Values" Or r.Value2 = "Value" Then
r.Activate
found = True
Exit For
End If
Next
If found = True Then
Range(Selection, Selection.End(xlDown)).Select 'this is the
'column to change
Selection.NumberFormat = "@" 'not there yet, we have to
'add and remove a space
'from each cell to achieve desired result
For Each cell In Selection 'this is the slow part,
'this is too slow for 39800 rows
cell.Value = " " & cell.Value
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Next
End If
End With
Next
ActiveWorkbook.Save
End Sub
I'm currently using this macro for converting a column that has mixed
types (text and numeric) and change it to being text.
Sub AddSpace()
Dim r As Range
Dim Wks As Worksheet
Dim cell As Object
Dim found As Boolean
For IndexSheet = 1 To Sheets.Count
Set Wks = Sheets(IndexSheet)
With Wks
.Activate
'find the column that has to be changed
found = False
For Each r In .Range("1:1")
If r.Value2 = "Values" Or r.Value2 = "Value" Then
r.Activate
found = True
Exit For
End If
Next
If found = True Then
Range(Selection, Selection.End(xlDown)).Select 'this is the
'column to change
Selection.NumberFormat = "@" 'not there yet, we have to
'add and remove a space
'from each cell to achieve desired result
For Each cell In Selection 'this is the slow part,
'this is too slow for 39800 rows
cell.Value = " " & cell.Value
cell.Value = Right(cell.Value, Len(cell.Value) - 1)
Next
End If
End With
Next
ActiveWorkbook.Save
End Sub