LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Set value of a cell with a dropdown list during run time (C#)

On Wednesday, August 14, 2013 10:50:35 AM UTC-5, GS wrote:
On Wednesday, August 14, 2013 10:05:38 AM UTC-5, GS wrote: Hi there, I have a excel file that has dropdown list in a cell. I want to programatically set the value of the cell using following code and did not work. oSheet.Range["A1"].Value = "A1"; The same code works for a regular cell. Looks like that the dropdown listitems were from another sheet. Thanks very much for your help. Hugh As I mentioned in your other thread.., the value you're trying to enter in a DV cell must be in the DV List. Otherwise, it doesn't work! Try assigning one of the list items! -- Garry Free uenet access at http://www.eternal-september.org Classic VB Users Regroup comp.lang.basic.visual.misc microsoft.public.vb.general.discussion First, thanks very much for your help again. Yes, the value entered is one of the DV list items. But it did not work. I must miss something here. Please elaborate what you said, Gary. There is not like string.contains or string.match function that can be used. Sorry, Hugh, but I don't speak C#. I'm sure, though, that every function available in VB[A] (and much more) is available in the .Net languages in some way. Sorry I can't be of help with your syntax. My hope is that you could convert my sample code... -- Garry Free uenet access at http://www.eternal-september.org Classic VB Users Regroup comp.lang.basic.visual.misc microsoft.public.vb.general.discussion


Translation to C# is not a problem. As a matter of fact, oSheet.Range("A1").Validation.Formula1, or oSheet.Cells(1,1).Validation.Formula1 returned a error. The eoor is generic and means that Excel did not find Formula1. However, Formula1 is available under Validation. I am not sure if there is DV List name and I am new to Excel stuff. But I did find that Lititems are from another sheet.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
return value from a dropdown list in other cell martinezfer Excel Discussion (Misc queries) 2 January 25th 12 07:03 PM
editable cell in a dropdown list Nelson Noel Excel Worksheet Functions 1 February 21st 09 05:46 PM
Can a dropdown list option add color/time to a range? Outbacker Excel Discussion (Misc queries) 1 March 22nd 07 09:22 PM
result of selecting from the dropdown list should be a dropdown list No News Excel Worksheet Functions 0 July 5th 06 04:09 PM
result of selecting from the dropdown list should be a dropdown list No News Excel Worksheet Functions 2 July 1st 06 10:53 AM


All times are GMT +1. The time now is 08:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"