J
Jenni_Sweden
Hi!! I want to search an entire Worksheet and check if cells consists of only
numbers (all numeric). If a cell is only numeric then I want to search the
cell for blanks and remove them. So far I can search and remove blanks but I
cannot discriminate properly bewteen alpha and numeric. Please help me! I am
clueless. My code so far is:
Public Sub findAndRemoveBlanks()
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim rCell As Range
Set WB = Workbooks("Bok2")
Set SH = WB.Sheets("Dimension")
Set rng = SH.Range("A1300")
For Each rCell In rng.Cells
With rCell
If Not IsEmpty(.Value) Then
If Not .Value Like "*[A-Z]*" Then
.Replace What:=" ", Replacement:=""
End If
End If
End With
Next rCell
End Sub
numbers (all numeric). If a cell is only numeric then I want to search the
cell for blanks and remove them. So far I can search and remove blanks but I
cannot discriminate properly bewteen alpha and numeric. Please help me! I am
clueless. My code so far is:
Public Sub findAndRemoveBlanks()
Dim WB As Workbook
Dim SH As Worksheet
Dim rng As Range
Dim rCell As Range
Set WB = Workbooks("Bok2")
Set SH = WB.Sheets("Dimension")
Set rng = SH.Range("A1300")
For Each rCell In rng.Cells
With rCell
If Not IsEmpty(.Value) Then
If Not .Value Like "*[A-Z]*" Then
.Replace What:=" ", Replacement:=""
End If
End If
End With
Next rCell
End Sub