PDA

Click to See Complete Forum and Search --> : [RESOLVED] Find all Cells in a Range in Excel


thekeane
Jan 6th, 2006, 03:49 PM
I'm trying to dynamically create a table of results using the solver "By changing cells" information. If you use a the SolverGet function you can get a string that contains all of the cells that the user had selected.

I have parsed the string down to begin to create the table but was wondering if there is an easier way to get a list of all the cells in a range.

For example the user enters

Sheet1!B2:C3, Sheet1!D6, Sheet1!E5

So is there an easy way to find out that B2:C3 is really B2,B3,C2,C3 so I can put that as a column header.

Thanks

VBAhack
Jan 8th, 2006, 11:42 AM
This might help:

Sub ParseInput(ParamArray arglist() As Variant)
Dim arg As Variant
Dim i As Integer
Dim txt As String
For Each arg In arglist
For i = 1 To arg.Cells.Count
txt = arg(i).Address
'blah, blah, blah
Next i
Next arg
End Sub

thekeane
Jan 9th, 2006, 03:31 PM
Thanks, just what i was looking for. Modified it a little bit to use a two dimensional array, but pointed me in the right direction.