Assigning sequence of numbers to visible cells only using VBA code (avoid hidden rows)

VictoriaExcel

New Member
Joined
Nov 15, 2018
Messages
14
Hello,

I am having difficulty with assigning a specific sequence of numbers (seat numbers listed below) to specific records whilst keeping the order. For context, I have a running order of graduands and those known to be attending are marked as attending in column C as well as the row being highlighted orange by a previous macro conditionally formatting.

I have attempted to record a macro by filtering by colour, selecting only visible cells in column B for the full range of records (Seat No.) and entered a formula linking to the start of the below sequence in a different sheet ='TH Seat Nos.'!A2 but unfortunately because the pattern of those attending/not attending is not consistent the formula pulls in from the below sequence inconsistently. :confused:

Therefore, what I am asking is do you know how to assign the below sequence in sheet ='TH Seat Nos.'!A2 in order within column B to only records where column C is a Y.

I need to keep the existing order of the rows and the not attending records as we need the data to hand for slot ins on the day.

Many thanks in advance,

[TABLE="width: 128"]
<colgroup><col></colgroup><tbody>[TR]
[TD]A2[/TD]
[/TR]
[TR]
[TD]A3[/TD]
[/TR]
[TR]
[TD]A4[/TD]
[/TR]
[TR]
[TD]A5[/TD]
[/TR]
[TR]
[TD]A6[/TD]
[/TR]
[TR]
[TD]A7[/TD]
[/TR]
[TR]
[TD]A8[/TD]
[/TR]
[TR]
[TD]A9[/TD]
[/TR]
[TR]
[TD]A10[/TD]
[/TR]
[TR]
[TD]A11[/TD]
[/TR]
[TR]
[TD]A12[/TD]
[/TR]
[TR]
[TD]A13[/TD]
[/TR]
[TR]
[TD]A14[/TD]
[/TR]
[TR]
[TD]B2[/TD]
[/TR]
[TR]
[TD]B3[/TD]
[/TR]
[TR]
[TD]B4[/TD]
[/TR]
[TR]
[TD]B5[/TD]
[/TR]
[TR]
[TD]B6[/TD]
[/TR]
[TR]
[TD]B7[/TD]
[/TR]
[TR]
[TD]B8[/TD]
[/TR]
[TR]
[TD]B9[/TD]
[/TR]
[TR]
[TD]B10[/TD]
[/TR]
[TR]
[TD]B11[/TD]
[/TR]
[TR]
[TD]B12[/TD]
[/TR]
[TR]
[TD]B13[/TD]
[/TR]
[TR]
[TD]B14[/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R]
[TD]W7[/TD]
[/TR]
[TR]
[TD]W8[/TD]
[/TR]
[TR]
[TD]W9[/TD]
[/TR]
</tbody>[/TABLE]
 
You are welcome ...

Glad you could fix your problem ...
 
Upvote 0

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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