VBA to get actual cell address from filtered list

Trickyrla

New Member
Joined
Jul 11, 2003
Messages
9
Hope you guys can help
This is probably really simple.

I have about 1000 rows of data in about 15 columns
These columns can be filtered.
Once filtered I would like to be able to select a cell and store its actual address in some vba code that will be initiated once the cell is selected, and then for subsequent use in some VBA code when the columns are not filtered.

I have worked out that Activecell.Address gives me the address of the selected cell, but this address is relative to the filtering. For example I am getting an address of say $A$2 as the ActiveCell.Address when the actual address of the selected cell is really on row 376 ie $A$376.

Can anyone suggest a way of getting the actual address please?
Many thanks

Tricky
 

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,934
If A376 was the actual selected cell, you would not get A2 as the returned value? Are you sure that you don't have multiple cells selected?

What does this give you?

msgbox "Selected cell is " & selection.address
 

Trickyrla

New Member
Joined
Jul 11, 2003
Messages
9
This is weird

correct address shows up in message, so everything should be OK.
have stepped through all lines of code again and found the problem.
Now I feel a real idiot!!
I had 2 variables to store the address in the first spelt curadds and the second curradds.
Now all seems OK I hope.
I just couldn't see for looking!!
Thanks for such a swift response.

Tricky
 

schielrn

Well-known Member
Joined
Apr 4, 2007
Messages
6,934
No problem. I have to admit it probably won't be your last time you do that, because I know I have done that many of times.
 

Forum statistics

Threads
1,085,863
Messages
5,386,395
Members
401,997
Latest member
cizwiz

Some videos you may like

This Week's Hot Topics

Top