+ Reply to Thread
Results 1 to 3 of 3

Way to store cell location to variable?

  1. #1
    Registered User
    Join Date
    07-07-2006
    Posts
    8

    Way to store cell location to variable?

    I was wondering if there was a way to store a cell's location to variables.

    Something like:
    Please Login or Register  to view this content.
    I'm currently working with a fairly large worksheet, and I'm using Cells.Find to look for a specific cell. Then I want to Filter that column, but I can't figure out what column Selection.AutoFilter Field:=?? should be.

    Any suggestions?

  2. #2
    Nick Hodge
    Guest

    Re: Way to store cell location to variable?

    Farful

    Here are a few ways

    Sub AssignToVariables()
    Dim sAddress
    Dim lRow As Long
    Dim iColumn As Integer
    With ActiveCell
    sAddress = .Address
    lRow = .Row
    iColumn = .Column
    End With
    MsgBox "Active cell address is " & sAddress & Chr(13) & _
    "Row is, " & lRow & ". Column is, " & iColumn & "." & Chr(13) & _
    "Therefore I can also reference it: Cells(" & lRow & " , " & iColumn &
    ")"
    End Sub

    --
    HTH
    Nick Hodge
    Microsoft MVP - Excel
    Southampton, England
    www.nickhodge.co.uk
    [email protected]HIS


    "farful" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I was wondering if there was a way to store a cell's location to
    > variables.
    >
    > Something like:
    >
    > Code:
    > --------------------
    >
    > int a, b
    > Cell(a, b) = ActiveCell
    > --------------------
    >
    >
    > I'm currently working with a fairly large worksheet, and I'm using
    > Cells.Find to look for a specific cell. Then I want to Filter that
    > column, but I can't figure out what column Selection.AutoFilter
    > Field:=?? should be.
    >
    > Any suggestions?
    >
    >
    > --
    > farful
    > ------------------------------------------------------------------------
    > farful's Profile:
    > http://www.excelforum.com/member.php...o&userid=36172
    > View this thread: http://www.excelforum.com/showthread...hreadid=560892
    >




  3. #3
    Don Guillett
    Guest

    Re: Way to store cell location to variable?

    close
    a=1
    b=2
    Cells(a, b).value = ActiveCell
    ----------------

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "farful" <[email protected]> wrote in
    message news:[email protected]...
    >
    > I was wondering if there was a way to store a cell's location to
    > variables.
    >
    > Something like:
    >
    > Code:
    > --------------------
    >
    > int a, b
    > Cell(a, b) = ActiveCell
    > --------------------
    >
    >
    > I'm currently working with a fairly large worksheet, and I'm using
    > Cells.Find to look for a specific cell. Then I want to Filter that
    > column, but I can't figure out what column Selection.AutoFilter
    > Field:=?? should be.
    >
    > Any suggestions?
    >
    >
    > --
    > farful
    > ------------------------------------------------------------------------
    > farful's Profile:
    > http://www.excelforum.com/member.php...o&userid=36172
    > View this thread: http://www.excelforum.com/showthread...hreadid=560892
    >




+ 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