![]() |
Copy Value from ComboBox to Cell
I am trying to copy the value of the combobox to a cell and am having
difficulties. Below is the test I tried and could not get it to work. Private Sub ComboBox10_Change() If ComboBox10.Value = 0 Then Range(e4).Value = " " ElseIf ComboBox10.Value = 1 Then Range(e4).Value = "Urgent" ElseIf ComboBox10.Value = 2 Then Range(e4).Value = "Routine" End If End Sub Any help would be appreciated. Thanks Tim Duell Buckeye Shapeform |
Copy Value from ComboBox to Cell
Hi
Can you please explain what is happening vs what you expect. Thanks. "Tim Duell" wrote: I am trying to copy the value of the combobox to a cell and am having difficulties. Below is the test I tried and could not get it to work. Private Sub ComboBox10_Change() If ComboBox10.Value = 0 Then Range(e4).Value = " " ElseIf ComboBox10.Value = 1 Then Range(e4).Value = "Urgent" ElseIf ComboBox10.Value = 2 Then Range(e4).Value = "Routine" End If End Sub Any help would be appreciated. Thanks Tim Duell Buckeye Shapeform |
Copy Value from ComboBox to Cell
For the example below I get the following error
Run-time error '1004': Method 'Range' of object '_worksheet' failed. Thanks Tim "Alok" wrote in message ... Hi Can you please explain what is happening vs what you expect. Thanks. "Tim Duell" wrote: I am trying to copy the value of the combobox to a cell and am having difficulties. Below is the test I tried and could not get it to work. Private Sub ComboBox10_Change() If ComboBox10.Value = 0 Then Range(e4).Value = " " ElseIf ComboBox10.Value = 1 Then Range(e4).Value = "Urgent" ElseIf ComboBox10.Value = 2 Then Range(e4).Value = "Routine" End If End Sub Any help would be appreciated. Thanks Tim Duell Buckeye Shapeform |
Copy Value from ComboBox to Cell
Prepend the range names with the programmatic name of the Sheet. You can find
the programmatic names of the sheets by looking at the Explorer in the VB IDE. Usually Sheet1 has the programmatic name Sheet1 and Sheet2 has the programmatic name Sheet2. However this is not always so. So try putting Sheet1.Range("E4").value =.. etc. "Tim Duell" wrote: For the example below I get the following error Run-time error '1004': Method 'Range' of object '_worksheet' failed. Thanks Tim "Alok" wrote in message ... Hi Can you please explain what is happening vs what you expect. Thanks. "Tim Duell" wrote: I am trying to copy the value of the combobox to a cell and am having difficulties. Below is the test I tried and could not get it to work. Private Sub ComboBox10_Change() If ComboBox10.Value = 0 Then Range(e4).Value = " " ElseIf ComboBox10.Value = 1 Then Range(e4).Value = "Urgent" ElseIf ComboBox10.Value = 2 Then Range(e4).Value = "Routine" End If End Sub Any help would be appreciated. Thanks Tim Duell Buckeye Shapeform |
Copy Value from ComboBox to Cell
All that is missing in your original code is the quotation marks around the
Ranges Range("E4") = "" If you want to send it to a specific sheet then use Alok's method. -- Charles Chickering "A good example is twice the value of good advice." "Alok" wrote: Prepend the range names with the programmatic name of the Sheet. You can find the programmatic names of the sheets by looking at the Explorer in the VB IDE. Usually Sheet1 has the programmatic name Sheet1 and Sheet2 has the programmatic name Sheet2. However this is not always so. So try putting Sheet1.Range("E4").value =.. etc. "Tim Duell" wrote: For the example below I get the following error Run-time error '1004': Method 'Range' of object '_worksheet' failed. Thanks Tim "Alok" wrote in message ... Hi Can you please explain what is happening vs what you expect. Thanks. "Tim Duell" wrote: I am trying to copy the value of the combobox to a cell and am having difficulties. Below is the test I tried and could not get it to work. Private Sub ComboBox10_Change() If ComboBox10.Value = 0 Then Range(e4).Value = " " ElseIf ComboBox10.Value = 1 Then Range(e4).Value = "Urgent" ElseIf ComboBox10.Value = 2 Then Range(e4).Value = "Routine" End If End Sub Any help would be appreciated. Thanks Tim Duell Buckeye Shapeform |
Copy Value from ComboBox to Cell
Thank you very much worked just like you said.
Now the next part of this is bound column. When this is set to 0 the code will work, but the value of the combobox will not stay when file is saved and reopened. When I say value I mean the text displayed in the box. When bound column is set to 1 the code will not work, or does not have the desired outcome, No information shows up in cell E4, but the value, text displayed, will not stay when file is saved and reopened. What am I doing wrong? Thanks so much for all the help. Tim Duell Buckeye Shapeform "Charles Chickering" wrote in message ... All that is missing in your original code is the quotation marks around the Ranges Range("E4") = "" If you want to send it to a specific sheet then use Alok's method. -- Charles Chickering "A good example is twice the value of good advice." "Alok" wrote: Prepend the range names with the programmatic name of the Sheet. You can find the programmatic names of the sheets by looking at the Explorer in the VB IDE. Usually Sheet1 has the programmatic name Sheet1 and Sheet2 has the programmatic name Sheet2. However this is not always so. So try putting Sheet1.Range("E4").value =.. etc. "Tim Duell" wrote: For the example below I get the following error Run-time error '1004': Method 'Range' of object '_worksheet' failed. Thanks Tim "Alok" wrote in message ... Hi Can you please explain what is happening vs what you expect. Thanks. "Tim Duell" wrote: I am trying to copy the value of the combobox to a cell and am having difficulties. Below is the test I tried and could not get it to work. Private Sub ComboBox10_Change() If ComboBox10.Value = 0 Then Range(e4).Value = " " ElseIf ComboBox10.Value = 1 Then Range(e4).Value = "Urgent" ElseIf ComboBox10.Value = 2 Then Range(e4).Value = "Routine" End If End Sub Any help would be appreciated. Thanks Tim Duell Buckeye Shapeform |
All times are GMT +1. The time now is 07:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com