+ Reply to Thread
Results 1 to 3 of 3

VBA: Loop through cells in matrix and return column- and row headers

  1. #1
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    VBA: Loop through cells in matrix and return column- and row headers

    I'm struggling with a piece of code I'm working on.

    I want to loop through each cell of one table and compare their column headers (text) and row headers (dates) with the contents of another table.

    Currently my code looks like this:
    Please Login or Register  to view this content.
    Any help and suggestions are much appreciated!
    Sincerely
    S?ren Larsen

    "Give a man a fish, and you'll feed him for a day. Give a man a fishing rod, and he'll steal your yacht!"

  2. #2
    Valued Forum Contributor StevenM's Avatar
    Join Date
    03-23-2008
    Location
    New Lenox, IL USA
    MS-Off Ver
    2007
    Posts
    910

    Re: VBA: Loop through cells in matrix and return column- and row headers

    I don't know what your code does, but cDummy and c1Historik should be declared to be As Range, and then they should be treated as a range.

    Assuming that "rDummy" is a name of a range, then:

    Please Login or Register  to view this content.
    cDummy is a one-cell Range inside Range("rDummy"), as such it acts like a Range variable.

    Please Login or Register  to view this content.
    This will return the value of the first cell with data to the left of cDummy.Address.

  3. #3
    Valued Forum Contributor
    Join Date
    03-16-2012
    Location
    Aarhus, Denmark
    MS-Off Ver
    Excel 2007
    Posts
    992

    Re: VBA: Loop through cells in matrix and return column- and row headers

    Thanks; I see where I got it wrong! For good measure; here is the final and working code:
    Please Login or Register  to view this content.

+ 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