+ Reply to Thread
Results 1 to 3 of 3

find and select all cells with a alphabetic character

  1. #1
    Giz
    Guest

    find and select all cells with a alphabetic character

    I am trying to create a macro that finds, on a worksheet, all cells with an
    alphabetic character (i.e. "a" or "b" or "c", etc.), and then selects them.
    ANy ideas??

  2. #2
    Jim Thomlinson
    Guest

    RE: find and select all cells with a alphabetic character

    Try this

    Sub buildrange()
    Dim rng As Range
    Dim cell As Range
    Set rng = Nothing
    For Each cell In ActiveSheet.UsedRange
    If Not (IsNumeric(cell.Value)) Then 'Changed for previous post
    If rng Is Nothing Then
    Set rng = cell
    Else
    Set rng = Union(rng, cell)
    End If
    End If
    Next cell
    If Not rng Is Nothing Then
    rng.Select
    End If
    End Sub
    --
    HTH...

    Jim Thomlinson


    "Giz" wrote:

    > I am trying to create a macro that finds, on a worksheet, all cells with an
    > alphabetic character (i.e. "a" or "b" or "c", etc.), and then selects them.
    > ANy ideas??


  3. #3
    Tom Ogilvy
    Guest

    Re: find and select all cells with a alphabetic character

    Building on Gary's reply to your first post

    Sub buildrange()
    Dim rng As Range
    Dim cell As Range
    Set rng = Nothing
    For Each cell In ActiveSheet.UsedRange
    If cell.Value = "a" or cell.Value = "b" or _
    cell.Value = "c" or cell.Value = "d" Then
    If rng Is Nothing Then
    Set rng = cell
    Else
    Set rng = Union(rng, cell)
    End If
    End If
    Next cell
    If Not rng Is Nothing Then
    rng.Select
    End If
    End Sub

    if you mean all cells containing a string constants

    Cells.specialCells(xlConstants,xlTextValues).Select

    --
    Regards,
    Tom Ogilvy



    "Giz" <[email protected]> wrote in message
    news:[email protected]...
    > I am trying to create a macro that finds, on a worksheet, all cells with

    an
    > alphabetic character (i.e. "a" or "b" or "c", etc.), and then selects

    them.
    > ANy ideas??




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1