+ Reply to Thread
Results 1 to 2 of 2

How to express a cell address into numeric for array use

  1. #1
    Susan Hayes
    Guest

    How to express a cell address into numeric for array use

    Im trying to to convert a cell address (ie E4) into some numeric form so I can enter it into a 2d array
    Im not sure how to do this especially when there is a number and letter.

    Also related is that im trying to clear a cell if it doesnt meet some criteria. It keeps looping for several iterations

    Dim rng As Range
    Set rng = Target.Cells

    With rng.Select

    'I tried selection.clearcontents but loops
    'also tried Cells(i + 3, Chr(68 + j)).Select where i and j are used in for loops

    End With

    Thanks
    Mike




  2. #2
    Bob Phillips
    Guest

    Re: How to express a cell address into numeric for array use

    Susan,

    Dim str

    str = "E4"
    Debug.Print Range(str).Row
    Debug.Print Range(str).Column
    str = "AI4"
    Debug.Print Range(str).Row
    Debug.Print Range(str).Column

    By this, I am trying to show that if you have a string, I use str, containg
    a cell address string, you can use the Range object row and column
    properties to get a number. This also takes care of a string like AI1, as my
    example shows.

    The Cells can take a column letter or number, so there is no need for the
    Chr. Just use
    Cells(i + 3, j +4).Select
    although of course you never need to do a Select ;-)

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Susan Hayes" <[email protected]> wrote in message
    news:[email protected]...
    > Im trying to to convert a cell address (ie E4) into some numeric form so I

    can enter it into a 2d array
    > Im not sure how to do this especially when there is a number and letter.
    >
    > Also related is that im trying to clear a cell if it doesnt meet some

    criteria. It keeps looping for several iterations
    >
    > Dim rng As Range
    > Set rng = Target.Cells
    >
    > With rng.Select
    >
    > 'I tried selection.clearcontents but loops
    > 'also tried Cells(i + 3, Chr(68 + j)).Select where i and j are

    used in for loops
    >
    > End With
    >
    > Thanks
    > Mike
    >
    >
    >




+ 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