Setting a combobox to a cell value

svjack9

New Member
Joined
Feb 9, 2014
Messages
32
I have form that is populated with agricultural spray records that have been saved in a worksheet(Spray_Records). When entering a new spray record, A combobox on that form (which is populated during form_initialize()) contains a list of chemicals retrieved from a different worksheet(Chemicals). Once the spray application has been inputted I save it as a new record in Spray_Records. The line that saves the chemical name and EPA registration number is:

ws_Spray_Records.cells(5, ColumnNumber)=me.cboChemicalName.Column(0) 'The chemical name
ws_Spray_Records.cells(6,ColumnNumber) = me.cboChemicalName.Column(1) 'EPA Registration Number

Later, if I want to populate the form with an existing record, all the textboxes display the data with no problem. However, cboChemicalName is blank even though the chemical was saved correctly. The retrieval code looks like this:

me.cboChemicalName=ws_Spray_Records.cells(5, ColumnNumber)

I'm sure this is where the problem lies, but I can't seem to find a solution. Any help would be greatly appreciated.
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You are saving in Sheets("Spray_Records") I assume. (You have it without an s (Worksheet) and no double quotes.
When you want to retrieve you use ws_Spray_Records
What are we missing or what did you not show us (like the complete code)
 
Upvote 0

Forum statistics

Threads
1,215,832
Messages
6,127,150
Members
449,366
Latest member
reidel

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