Consulting

Results 1 to 5 of 5

Thread: How to make a range dynamic?

  1. #1

    How to make a range dynamic?

    Hey guys,

    Stumbled on this forum while trying to google up an answer for a problem I am having.

    Basically I want to make a range dynamic.

    For example, what I have is that:

    For i = 1 to 100
    Range((2+i,3),(2+i+5,3))
    Next i

    However, excel does not read this properly as you can't use equations as cell values when using range. So is there a way to go around that. I am trying to find the max value in a range of cells and its being a real pain to figure this out.

    Would greatly appreciate any assistance. Thanks.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Range(Cells(2+i,3),Cells(2+i+5,3))
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    take a look at offset in the help files.....
    If you show us what your doing it would help to understand the problem.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    well that's just me...
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    Thanks a ton lucas and xld! xld> Your code did the trick. Should have realized that cells would have added the values into the range. I will try to post up more details of the project when I ask for help again .

Posting Permissions

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