LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default C# vba development

I created a button, to dynamically create a validation on cell

the following is the code i wrote:

......

Excel.Range thisRange =
((Excel.Worksheet)(this.thisWorkbook.Worksheets.ge t_Item("XXXXX"))).get_Range("A1", Type.Missing);

thisRange.Validation.Add(Excel.XlDVType.xlValidate List,
Excel.XlDVAlertStyle.xlValidAlertStop,
Excel.XlFormatConditionOperator.xlBetween,"Yes, No", Type.Missing);

......

I tested, and found that thisRange is not null and thisRange.Validation is
not null either. However, when i wrong the code, and clicked the button, it
tells me "Object Reference is Not set to an instance of an object".

But the range object is not, while validation is not null either. Can anyone
help me solve this problem?

Many thanks
 
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
New Excel development ledgreg Excel Discussion (Misc queries) 2 February 27th 06 08:35 PM
Development tool,Excel,GUI BrianG Excel Discussion (Misc queries) 3 December 27th 04 02:05 PM
Form development question Matt Jensen Excel Programming 11 December 9th 04 11:08 AM
A development of a Macro by Tom Tom Ogilvy Excel Programming 1 July 31st 04 07:29 PM
EXCEL MACRO DEVELOPMENT Joao Saraiva Excel Programming 1 January 23rd 04 10:35 AM


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

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"