+ Reply to Thread
Results 1 to 8 of 8

Equating ranges

  1. #1
    Registered User
    Join Date
    10-30-2013
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2013 x64
    Posts
    5

    Equating ranges

    This might be a really simple problem, but I am new to VBA and it has been bothering me for a while.

    I want to equate a worksheet's range with another worksheet's range. My code is as follows:

    Please Login or Register  to view this content.
    The code executes until the last line (Executes perfectly when I remove the line). When I include
    Range(Cells(2, 2), Cells(z, 2)) = Sheets("DATA_CLFLINE").Range(Cells(2, 9), Cells(z, 9))
    I get an error: "Application defined or object defined error"

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Equating ranges

    Try:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-30-2013
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2013 x64
    Posts
    5

    Re: Equating ranges

    I tried that. Unfortunately, I get the same error:

    Run-time error '1004':
    Application-defined or object-defined error.

  4. #4
    Registered User
    Join Date
    10-30-2013
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2013 x64
    Posts
    5

    Re: Equating ranges

    I separated out the code and tried the following to test it:

    Please Login or Register  to view this content.
    The first part works, but there is something wrong with the second part.

  5. #5
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Equating ranges

    Try:
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    10-30-2013
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2013 x64
    Posts
    5

    Re: Equating ranges

    Worked like a charm. Thanks a lot. Lastly, could you tell me why this happened? Is it because I am running the x64 version, which does not recognize some of the codes?

  7. #7
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: Equating ranges

    Not sure actually, I noticed it a few times myself when I try and use a range(cells(a,b),cells(x,y)) construct to define a range. I think maybe it only works on the activesheet but I'm not 100% sure on that.

  8. #8
    Registered User
    Join Date
    10-30-2013
    Location
    Istanbul, Turkey
    MS-Off Ver
    Excel 2013 x64
    Posts
    5

    Re: Equating ranges

    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)

Similar Threads

  1. Replies: 9
    Last Post: 11-07-2012, 03:13 AM
  2. Replies: 0
    Last Post: 10-15-2012, 07:24 AM
  3. Replies: 4
    Last Post: 06-28-2011, 01:57 AM
  4. sum not equating to parts
    By tinkerbelle in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-10-2007, 05:26 AM
  5. Copy data in named ranges to a newer version of the same template to identical ranges
    By handstand in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-21-2006, 10:51 AM

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