+ Reply to Thread
Results 1 to 8 of 8

How to add cells to range?

  1. #1
    Forum Contributor
    Join Date
    06-14-2010
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2003
    Posts
    145

    How to add cells to range?

    Hi,
    I am fairly new to VBA
    This is probably easy, but I can;t figure it out lol

    Can someone provide me a code such that I can add items to range?

    For example, the function code shuold loop through one of the columns and add that cell to a range, if they contain a value in it (doesn;t matter which value).

    thanks
    Last edited by adds007; 06-19-2010 at 10:18 PM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to add cells to range?

    Not sure what you want. You should certainly avoid Loops when possible.

    Look at UsedRange or CurrentRegion in the VBA Help
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    06-14-2010
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2003
    Posts
    145

    Re: How to add cells to range?

    Hi again,
    I have attached an example of what I want to do.

    You can click the boxes to put checkmarks or select a block of cells(if there is a faster way, i am all open)
    What I want to do is declare a range object, then store the cell addresses (not the values inside it) to that range
    So that I can work with the rows that are checked.
    Attached Files Attached Files

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to add cells to range?

    You would be better saying what you need to store the addresses for,you will probably get a more efficient answer.

  5. #5
    Forum Contributor
    Join Date
    06-14-2010
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2003
    Posts
    145

    Re: How to add cells to range?

    Sorry about that
    At my work I have been told to make a macro to compile a cable list.
    The cable list tho contains all types of cables.
    So I already made the option for user to select cells that they want to compile a list for (using checkmarks)

    So now I am working on a program which basically checks for all the "checks" and compile a list for only those cables (checked ones).

    I tried using UsedRange or CurrentRange, but none of do what I want

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How to add cells to range?

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Forum Contributor
    Join Date
    06-14-2010
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2003
    Posts
    145

    Re: How to add cells to range?

    Sorry for late reply
    I have to go somewhere, but I tried the code u posted just before u left and it seems to do what I want!!
    I will work on it after I am back and will let you guys know

    THANKS a lot

  8. #8
    Forum Contributor
    Join Date
    06-14-2010
    Location
    Toronto,Canada
    MS-Off Ver
    Excel 2003
    Posts
    145

    Re: How to add cells to range?

    YES!!!!
    IT WORKED!!!!!
    thanks a lot

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1