Hi
I have a listbox within a userform that contains 9 different locations. The user selects the relevant locations and when they submit the user form the the selected values are transferred to a spreadhseet. The layout of the spreadhseet is similar to the table below. The locations are pre-poluated in the spreadsheet as column headers and the value "True" is populated under the relevant header and in the relevant row when the form is submitted.
Now I want to be able to to open a blank version of the userform and pull through the location data in to the list box for a particular Request ID. For exampe, for NR1 I would want locations 1, 4,6 and 7 selected in the listbox. This is where I'm totally stuck! I have the following code to identify the relevant row based on the user entering the request ID in to a search box:
(my variable is the requst Id entered by the user, WSI is the worksheet. Request ID in my spreadsheet is in column B not column A as it is shown below)
I don't know where to go after this! I was thinking along the lines of If functions to determine if the value is true or not blank for each location but I don't know how to write it in code. Alternatively, if it's not possible to select the list box items I considered populating a text box with the location names, again based on if the relevant cell contains "True" but again couldn't think how to write this
Any help greatly appreciated
[TABLE="width: 500"]
<tbody>[TR]
[TD]Request ID[/TD]
[TD]Location1[/TD]
[TD]Location2[/TD]
[TD]Location3[/TD]
[TD]Location4[/TD]
[TD]Location5[/TD]
[TD]Location6[/TD]
[TD]Location7[/TD]
[TD]Location8[/TD]
[TD]Location9[/TD]
[/TR]
[TR]
[TD]NR1[/TD]
[TD]True[/TD]
[TD][/TD]
[TD][/TD]
[TD]True[/TD]
[TD][/TD]
[TD]True[/TD]
[TD]True[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NR2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]True[/TD]
[/TR]
[TR]
[TD]NR3[/TD]
[TD]True[/TD]
[TD][/TD]
[TD]True[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NR4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NR5[/TD]
[TD][/TD]
[TD]True[/TD]
[TD]True[/TD]
[TD][/TD]
[TD][/TD]
[TD]True[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NR6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]True[/TD]
[TD]True[/TD]
[/TR]
</tbody>[/TABLE]
I have a listbox within a userform that contains 9 different locations. The user selects the relevant locations and when they submit the user form the the selected values are transferred to a spreadhseet. The layout of the spreadhseet is similar to the table below. The locations are pre-poluated in the spreadsheet as column headers and the value "True" is populated under the relevant header and in the relevant row when the form is submitted.
Now I want to be able to to open a blank version of the userform and pull through the location data in to the list box for a particular Request ID. For exampe, for NR1 I would want locations 1, 4,6 and 7 selected in the listbox. This is where I'm totally stuck! I have the following code to identify the relevant row based on the user entering the request ID in to a search box:
Code:
Rw = Application.Match(MyVar, WSi.Range("B:B"), 0)
(my variable is the requst Id entered by the user, WSI is the worksheet. Request ID in my spreadsheet is in column B not column A as it is shown below)
I don't know where to go after this! I was thinking along the lines of If functions to determine if the value is true or not blank for each location but I don't know how to write it in code. Alternatively, if it's not possible to select the list box items I considered populating a text box with the location names, again based on if the relevant cell contains "True" but again couldn't think how to write this
Any help greatly appreciated

[TABLE="width: 500"]
<tbody>[TR]
[TD]Request ID[/TD]
[TD]Location1[/TD]
[TD]Location2[/TD]
[TD]Location3[/TD]
[TD]Location4[/TD]
[TD]Location5[/TD]
[TD]Location6[/TD]
[TD]Location7[/TD]
[TD]Location8[/TD]
[TD]Location9[/TD]
[/TR]
[TR]
[TD]NR1[/TD]
[TD]True[/TD]
[TD][/TD]
[TD][/TD]
[TD]True[/TD]
[TD][/TD]
[TD]True[/TD]
[TD]True[/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NR2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]True[/TD]
[/TR]
[TR]
[TD]NR3[/TD]
[TD]True[/TD]
[TD][/TD]
[TD]True[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NR4[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NR5[/TD]
[TD][/TD]
[TD]True[/TD]
[TD]True[/TD]
[TD][/TD]
[TD][/TD]
[TD]True[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]NR6[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]True[/TD]
[TD]True[/TD]
[/TR]
</tbody>[/TABLE]