+ Reply to Thread
Results 1 to 4 of 4

CurrentRegion Property Problem

  1. #1
    Registered User
    Join Date
    01-16-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    11

    CurrentRegion Property Problem

    I am following the Excel 2007 VBA Programmer's Reference book and stumbled into a problem.

    Please Login or Register  to view this content.
    The line that is bold and underlined is the one that is highlighted when I try to run this code.

    I attached the worksheet as well.

    The code is supposed to add all the values in each table and display them in the new "Consolidation" worksheet.

    Not sure what is going wrong. Any help would be greatly appreciated.
    Attached Files Attached Files
    Last edited by Pelusa; 02-23-2012 at 05:46 PM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: CurrentRegion Property Problem

    The code uses named ranges, such as "mangoes". Your file does not include any named ranges so the code fails.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    01-16-2012
    Location
    Canada
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: CurrentRegion Property Problem

    Fixed it with:

    Please Login or Register  to view this content.
    Is there a way get the same effect using the vlookup function?

    I am just wondering since I am still learning VBA.

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: CurrentRegion Property Problem

    If you alter the name range defintions then yes.

    Please Login or Register  to view this content.
    Formula in B4 copy over and down.

    Consolidation!B4: =SUM(VLOOKUP($A4,Mangoes,COLUMN(),FALSE),VLOOKUP($A4,Bananas,COLUMN(),FALSE),VLOOKUP($A4,Lychees,COLUMN(),FALSE),VLOOKUP($A4,Rambutan,COLUMN(),FALSE))

+ 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