Returning Missing Variables on A Merge Cell

ryan8200

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

I need your kind assistance with regards VBA. Attached herewith is the sample data,together with the output.


For this questions, There are 5 candidates in the list and each of them will take part on their favorites sports during weekday or weekend. If they participate in a sports, "Y" will be labeled. If not, "N" will be labeled"


Below is the VBA code that I'm using. [Sub MissingHobbies()
Dim c As Integer, h As Integer, ans As Integer
ans = 9
For c = 2 To 11 ' candidates
For h = 3 To 6 ' hobbies
Cells(8, 1) = "Hobbies"
Cells(8, 2) = "Candidates"
If Cells(h, c) = "N" Then
Cells(ans, 1) = Cells(h, 1)
Cells(ans, 2) = Cells(1, c)
ans = ans + 1
Else
End If
Next h
Next c
End
End
End Sub

][/CODE]


There is problem with the merge cell. If I can return the value for non-participate sports on weekday, I cannot return the
non-participate sports on weekend.

Appreciate if the fellow members can give me a helping hand.

Many thanks.

qNmx8Lz
 
Last edited:

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Please refer to [FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]https://ibb.co/qNmx8Lz for the sample data and output [/FONT]
 
Upvote 0

Forum statistics

Threads
1,224,817
Messages
6,181,144
Members
453,021
Latest member
Justyna P

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