Macro Statement To Select Cell in a Column that Begin with a Letter

dmcgetti

Board Regular
Joined
Feb 16, 2015
Messages
66
Just like the title states, I need to select all of the cells in
Code:
Range("Table1[[#Headers],[PO'#]]")
that begin with a letter, there is both numbers and letters in the table and it is sorted "A-Z" already.

Thanks in Advance!
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
How about
Code:
   Range("Table1[PO'#]").SpecialCells(xlConstants, xlTextValues).Select
 
Upvote 0
I think something along the lines of this might work

Code:
InStr(1, Range[COLOR=#333333]("Table1[PO'#]")[/COLOR], "[A-Z]", vbBinaryCompare)

but I don't know if there is a way to search for "Any" text, "[A-Z]" doesn't work.
 
Last edited:
Upvote 0
Ok how about
Code:
Dim rng As Range
Dim Cl As Range
For Each Cl In Range("Table1[PO'#]")
   If Not IsNumeric(Left(Cl, 1)) Then
      If rng Is Nothing Then Set rng = Cl Else Set rng = Union(rng, Cl)
   End If
Next Cl
rng.Select
 
Upvote 0
Thanks that works!

Now, can you explain it, I need to do it a 2nd time in another column and I am not fully comprehending.
 
Upvote 0
Code:
Dim rng As Range
Dim Cl As Range
For Each Cl In Range("Table1[PO'#]")      'Loops through the PO column
   If Not IsNumeric(Left(Cl, 1)) Then     'Checks if the first character is a number
      If rng Is Nothing Then Set rng = Cl Else Set rng = Union(rng, Cl) 'Creates a range of all cells that do not start with a number
   End If
Next Cl
rng.Select  'selects the range
Added comments
 
Upvote 0
Code:
Dim rng As Range
Dim Cl As Range
For Each Cl In Range("Table1[PO'#]")      'Loops through the PO column
   If Not IsNumeric(Left(Cl, 1)) Then     'Checks if the first character is a number
      If rng Is Nothing Then Set rng = Cl Else Set rng = Union(rng, Cl) 'Creates a range of all cells that do not start with a number
   End If
Next Cl
rng.Select  'selects the range
Added comments

Thank You!!
 
Upvote 0

Forum statistics

Threads
1,215,063
Messages
6,122,935
Members
449,094
Latest member
teemeren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top