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
 

Some videos you may like

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

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.
 

Watch MrExcel Video

Forum statistics

Threads
1,090,101
Messages
5,412,427
Members
403,426
Latest member
Wally309

This Week's Hot Topics

Top