LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Find + remove blanks if cell contains only numbers

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("A1:P300")

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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
remove duplicates except blanks jat Excel Worksheet Functions 2 December 11th 09 12:25 PM
remove blanks using formula Gotroots Excel Worksheet Functions 5 December 9th 09 10:52 AM
Concatenate and remove blanks PeterW Excel Worksheet Functions 3 January 19th 06 06:04 PM
Find last used cell in row with blanks inbetween Les Stout[_2_] Excel Programming 10 October 9th 05 07:35 AM
remove blanks from a string of chars within a cell? rayhollidge Excel Discussion (Misc queries) 3 January 8th 05 02:43 AM


All times are GMT +1. The time now is 04:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"