+ Reply to Thread
Results 1 to 7 of 7

Use area property to set rows

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-05-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    301

    Use area property to set rows

    Hi all,

    This code sets an area based on columns, with groups of rows seperated by a blank row. it works well.

    Set myAreas = Sheets(1).Columns("a:f").SpecialCells(2, 1).Areas
    
    ArrayedAreaAddress = myareas(1).address
    I'm looking for the method to set myAreas so that I can set the myareas by individual rows within the columns

    e.g.

    Set myAreas = Sheets(1).Columns("a:f").Rows.Areas
    This doesn't work.

    Would anybody know how this is done

    Cheers

  2. #2
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: Use area property to set rows

    Areas is a property of a Range object which returns a collection that represents all the ranges in a multiple-area selection. The Rows Collection does not have an Areas property.
    What are you looking for? A collection of Rows in a specified range of columns?


    Please read the manual: http://msdn.microsoft.com/en-us/libr...ffice.15).aspx

  3. #3
    Forum Contributor
    Join Date
    03-05-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    301

    Re: Use area property to set rows

    Thank you for your response.

    Yes, I am looking for a collection of rows in a specified range of columns. I'm looking for a method that does (in principle) the same thing as the describe specialcells method, except instead of the area being defined by blank rows, i need the area defined by individual rows regardless of what's in the row.

    Can you show such a method ?

  4. #4
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: Use area property to set rows

    Sheets(1).Range("a:f").Rows will return the collection you are looking for but it will be more than 1 million members...


    Please read the manual: http://msdn.microsoft.com/en-us/libr...ffice.15).aspx

  5. #5
    Forum Contributor
    Join Date
    03-05-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    301

    Re: Use area property to set rows

    That property is good for feeding into an array, however, the problem is that I need the areas property. I need to compare a row range from one sheet against a row range from another sheet.

    After a number of hours looking for this function, I have found that you can evaluate one area against another area.

    So I need a row range ("A1:S1") defined as an area that I can evaluate against another row range (from another sheet)

  6. #6
    Forum Contributor
    Join Date
    10-30-2013
    Location
    Melbourne
    MS-Off Ver
    Excel 2013
    Posts
    173

    Re: Use area property to set rows

    It's a bit hard to understand how to help I'm afraid. What do you mean exactly by "evaluate one area against another?"


    Sent from my iPhone using Tapatalk

  7. #7
    Forum Contributor
    Join Date
    03-05-2013
    Location
    Sydney
    MS-Off Ver
    Excel 2010
    Posts
    301

    Re: Use area property to set rows

    This example may show what I'm trying to acheive, i.e everycell in RangeOne must match every cell in RangeTwo , except that this method doesn't work, but should at least demonstrate it.

    For i = 1 to 100
       RangeOne = Worksheet("SheetOne").Range("A" & i & ":S" & i)
       For j = 1 to 100
          RangeTwo = Worksheet("SheetTwo").Range("A" & j & ":S" & j)
          If RangeTwo = RangeOne then
             'do stuff with RangeOne
          End if
       Next J
    Next i
    I really didnt want to loop through each cell in a row if there's a better way.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 04-24-2013, 04:58 AM
  2. Set autofit property for designated rows on multiple sheets
    By mandora in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-08-2013, 09:37 PM
  3. [SOLVED] Excel run-time error '381': Could not set the List property. Invalid property array index
    By eemiller1997 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-20-2012, 12:48 PM
  4. Insert Rows in a Dynamic Area and then Add Text to New Rows
    By webee33 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-02-2008, 01:33 AM
  5. List Header Rows Property
    By Mike in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-10-2005, 05:06 PM

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