Results 1 to 2 of 2
  1. #1
    Star Lounger
    Join Date
    Feb 2006
    Posts
    71
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Variable Ranges in VB (2003)

    Want to create variable range based on content of a cell . Need range to fill based on content of another cell.
    Example: Range("G30:Gx").Interior.ColorIndex = 2 where x is content of cell A1 if content of Cell A1=35 then range would be G30:G35

    Being used to build a color block diagram of variable pieces in a frame

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Variable Ranges in VB (2003)

    Use:
    <code>
    Range("G30:G" & Range("A1")).Interior.ColorIndex = 2
    </code>
    The argument to Range is a string that can be an expression that concatenates several values.

Posting Permissions

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