Writing VBA macro for generating missing variable

ryan8200

Active Member
Joined
Aug 21, 2011
Messages
357
Hello members,

I would like to write VBA macro for listing the missing variables as per below.

Among candidates A, B C, D and E. I would like to list down the missing variables (Hobbies), accompanied by the candidates name.

[TABLE="width: 500"]
<tbody>[TR]
[TD]Hobbies[/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]Swimming[/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[TD]N[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]Tennis[/TD]
[TD]N[/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]Badminton[/TD]
[TD]N[/TD]
[TD]N[/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[TD]Y[/TD]
[/TR]
[TR]
[TD]Volleyball[/TD]
[TD]Y[/TD]
[TD]N[/TD]
[TD]N[/TD]
[TD]Y[/TD]
[TD]N[/TD]
[/TR]
</tbody>[/TABLE]

The expected outcome will be looked like as below:


[TABLE="width: 500"]
<tbody>[TR]
[TD]Hobbies [/TD]
[TD]Candidate[/TD]
[/TR]
[TR]
[TD]Tennis[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]Badminton[/TD]
[TD]A[/TD]
[/TR]
[TR]
[TD]Badminton [/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]Volleyball[/TD]
[TD]B[/TD]
[/TR]
[TR]
[TD]
Volleyball
<strike></strike>
[/TD]
[TD]C[/TD]
[/TR]
[TR]
[TD]Swimming[/TD]
[TD]D[/TD]
[/TR]
[TR]
[TD]Swimming[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]Tennis[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]Volleyball[/TD]
[TD]E[/TD]
[/TR]
</tbody>[/TABLE]


Your kind assistance is greatly appreciated.

Many thanks.

Regards,
Ryan
 
If you modified the existing macro, post your version now and I'll show you how to place the headers on.

Basically, from my original macro, you want to use something like:

Code:
Cells(7, 1) = "Hobbies"
Cells(7, 2) = "Candidate"

Always happy to help!

Kevin
 
Last edited:
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
If you modified the existing macro, post your version now and I'll show you how to place the headers on.

Basically, from my original macro, you want to use something like:

Code:
Cells(7, 1) = "Hobbies"
Cells(7, 2) = "Candidate"

Always happy to help!

Kevin


Thanks for the help. How to amend the code so that the output will be displayed at new worksheet instead of existing worksheet
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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