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,084,753
Messages
5,379,654
Members
401,620
Latest member
Ankur Teotia

Some videos you may like

This Week's Hot Topics

  • VBA code giving errors and stopping Excel
    Hello Experts, I have this code being used to loop through files in a file path, and copy specific data to another sheet. It is giving me several...
  • Disable MsgBox message
    Morning, I have a userform where if i leave a ComboBox empty i see a MsgBox warning me that i must enter an invoice number. It is this MsgBox i...
  • Macro Recorder into VBA, Copy Paste Data Filled Cells
    Hi Everyone, I have a macro recorder file that takes a selection of data, copies, then pastes into a new sheet on ("A2:B2") The issue is my...
  • Number format changes while pasting into a cell
    Hi, I am trying to paste a number 180204524303 from an email to an excel cell, however, whenever i try to do so , the the paste value appears as...
  • Collating data
    Hello all. Could someone please help. I am trying to pull all column data from multiple sheets (24 I total so far) into 1 master sheet without...
  • Sum Multiple Columns Based on Multiple Criteria
    I am trying to consolidate data by summing columns G through M based on material, plant, vendor, and fiscal year being identical. The period does...
Top