Results 1 to 3 of 3

Thread: [RESOLVED] Find all Cells in a Range in Excel

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    2

    Resolved [RESOLVED] Find all Cells in a Range in Excel

    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
    Last edited by thekeane; Jan 9th, 2006 at 04:32 PM.

  2. #2
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    Re: Find all Cells in a Range in Excel

    This might help:

    VB Code:
    1. Sub ParseInput(ParamArray arglist() As Variant)
    2.     Dim arg As Variant
    3.     Dim i As Integer
    4.     Dim txt As String
    5.     For Each arg In arglist
    6.         For i = 1 To arg.Cells.Count
    7.             txt = arg(i).Address
    8.             'blah, blah, blah
    9.         Next i
    10.     Next arg
    11. End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2006
    Posts
    2

    Resolved [Resolved] Find all Cells in a Range in Excel

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width