Fill a filtered column in a table with a text value "Y"

johnlink

New Member
Joined
Nov 24, 2017
Messages
10
Hi All

Using MS Excel 365.
Making VBA code to work on a table of data.
Code has applied a filter to the data and now want it to fill all cells in a column "E" with a text flag value "Y"
I can have my code go to the column header but cannot then activate the first filtered cell below in order to add the "Y" flag and then follow up with a fill down command.

Any macro recordings I have done just use absolute refs and cannot seem to find a way to just select the first row of the filtered data.

Have even tried sendkeys but no luck - probably a bad idea anyway?

Just a newbie so pls be kind

Thanks to all for time eagerly awaiting responses.

JP
 

Attachments

  • FILL DOWN IN FILTERED TABLE.png
    FILL DOWN IN FILTERED TABLE.png
    27 KB · Views: 28

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Something like:

VBA Code:
Activesheet.listobjects(1).listcolumns("YES").databodyrange.specialcells(xlcelltypevisible).value = "Y"
 
Upvote 0
Solution
OK thanks very much to RoryA for that amazing code - I put it in to my VBA module and all was solved.
I am still at a level of "recording" a macro then using the code from that recording to add to my modules - at times the recorder cannot perform the types of actions I need EG in this case.
Guess I will have to bite the bullet and get a good book of "how to write VBA code for Excel"??
Anyone with suggestions from their experience?
Thanks again RoryA.
 
Upvote 0

Forum statistics

Threads
1,223,892
Messages
6,175,236
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top