Way to store cell location to variable?

F

farful

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

Something like:

Code
-------------------

int a, b
Cell(a, b) = ActiveCel
-------------------


I'm currently working with a fairly large worksheet, and I'm usin
Cells.Find to look for a specific cell. Then I want to Filter tha
column, but I can't figure out what column Selection.AutoFilte
Field:=?? should be.

Any suggestions
 
N

Nick Hodge

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
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top