My name is Jacek,
Currently I'm using Visual Studio 2005 (with visual studio tools for office) to develop Excel 2003 Addin.

I would like to know how to create cell (range) selector the same like there is in Excel's solver addin.

I mean the one that u can click and dynamically choose some cells that You are working with.

Is there any built-in component


Re: Visual Studio Tools for Office Excel addin question


This is one of a sample, but I would rather do it to look like in solver, where there is more than 1 range chooser and all packed into a form. Can Anyone help me

Code Snippet

Excel.Range range = (Excel.Range)this.Application.InputBox("",
Type.Missing, "$C$27:$D$32", Type.Missing, Type.Missing, Type.Missing,
Type.Missing, 8);

Re: Visual Studio Tools for Office Excel addin question


Hi Jack,

As far as I know, the only built-in component which let us to choose a range and reflect it to textbox is Application.InputBox(), as your mentioned above. If you want to make it more like the Solver Add-in. You must write your form and add your control by your design-mind. Then in SeletionChange event handle, you can write back the text of range to textbox in your form.

And in the event handle method, there is a parameter passed in (Microsoft.Office.Interop.Excel.Range Target).This parameter has some properties which can help you to locate your selection and write it back to your textbox. (Target.Column, Target.Row, Target.Rows.Count, Target.Columns.Count)