Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default OFFSET and INDIRECT

I forgot to say the exception is in :

oValidDDLMetric.Add(Excel.XlDVType.xlValidateList,
Excel.XlDVAlertStyle.xlValidAlertStop, 1, source, Type.Missing);

regards

"daniel #" wrote in message
...
Hello Guys

i have a problem about dynamic ranges assigned to one cell.
On the attachment (sorry about that) we have two dropdowns dependents, I
am trying to do the same in C# code.

the source for the second dropdown (in the 8th row) in the example is :
=OFFSET(INDIRECT($B8),0,0,COUNTA(INDIRECT(B8&'Col' )),1)

I am trying the following code:

Excel.Range rngDDLMetric =
(Excel.Range)_xlsJudgmentData.Cells[currentRow, 2];
Excel.Validation oValidDDLMetric =
rngDDLMetric.Validation;

string source = "=OFFSET(INDIRECT($A" +
currentRow.ToString() + "),0,0,COUNTA(INDIRECT(A" + currentRow.ToString()
+ @"&""Col"")),1)";
oValidDDLMetric.Add(Excel.XlDVType.xlValidateList,
Excel.XlDVAlertStyle.xlValidAlertStop, 1, source, Type.Missing);

oValidDDLMetric.InCellDropdown = true;
oValidDDLMetric.ErrorTitle = "Error";
oValidDDLMetric.InputMessage = "Select an Metric";
oValidDDLMetric.ErrorMessage = "Invalid Option";
oValidDDLMetric.ShowError = true;
oValidDDLMetric.ShowInput = true;



But i get an exception.

Thanks in advance
Daniel




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default OFFSET and INDIRECT

I answer my own question. The problem was the Cell A didn't have data.

Warm Regards
Daniel


"daniel #" wrote in message
...
I forgot to say the exception is in :

oValidDDLMetric.Add(Excel.XlDVType.xlValidateList,
Excel.XlDVAlertStyle.xlValidAlertStop, 1, source, Type.Missing);

regards

"daniel #" wrote in message
...
Hello Guys

i have a problem about dynamic ranges assigned to one cell.
On the attachment (sorry about that) we have two dropdowns dependents, I
am trying to do the same in C# code.

the source for the second dropdown (in the 8th row) in the example is :
=OFFSET(INDIRECT($B8),0,0,COUNTA(INDIRECT(B8&'Col' )),1)

I am trying the following code:

Excel.Range rngDDLMetric =
(Excel.Range)_xlsJudgmentData.Cells[currentRow, 2];
Excel.Validation oValidDDLMetric =
rngDDLMetric.Validation;

string source = "=OFFSET(INDIRECT($A" +
currentRow.ToString() + "),0,0,COUNTA(INDIRECT(A" + currentRow.ToString()
+ @"&""Col"")),1)";
oValidDDLMetric.Add(Excel.XlDVType.xlValidateList,
Excel.XlDVAlertStyle.xlValidAlertStop, 1, source, Type.Missing);

oValidDDLMetric.InCellDropdown = true;
oValidDDLMetric.ErrorTitle = "Error";
oValidDDLMetric.InputMessage = "Select an Metric";
oValidDDLMetric.ErrorMessage = "Invalid Option";
oValidDDLMetric.ShowError = true;
oValidDDLMetric.ShowInput = true;



But i get an exception.

Thanks in advance
Daniel






Reply
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
OFFSET and INDIRECT AirgasRob Excel Discussion (Misc queries) 1 June 16th 08 09:01 PM
Offset/Indirect Help [email protected] Excel Worksheet Functions 1 December 10th 07 07:04 PM
Offset,Indirect Please help [email protected] Excel Discussion (Misc queries) 1 August 21st 06 10:54 PM
INDIRECT, OFFSET et. al. Wazooli Excel Worksheet Functions 2 March 24th 05 12:23 AM
Indirect versus Offset Dan[_28_] Excel Programming 2 February 10th 04 05:42 AM


All times are GMT +1. The time now is 05:12 PM.

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

About Us

"It's about Microsoft Excel"