+ Reply to Thread
Results 1 to 3 of 3

Logic problem with Range values

  1. #1
    Registered User
    Join Date
    03-10-2010
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    7

    Logic problem with Range values

    Hi,

    I'm having problems yet again. New to this. Here's what I'm trying to achieve:

    1. Open a worksheet - OK
    2. Get the range of values - OK
    3. Copy the values to a two dim array - not sure I want to do this anymore but oh well
    4. Close the worksheet - OK
    5. Open another existing work sheet - OK
    6. Insert the range into the new workseet - herewith lies my problem.

    I can't insert the values over top because I want to take the existing values and accumulate the new ones. Much like the paste special -> Numbers -> Add

    I initially tried (in step 2) to copy the text to the clipboard. However, when I close the sheet I get 'you have a large amount of data' message and it halts the script.

    I then tried putting it in the 2 dim array. This is not feasible because I really need the Address of the cells as well. Also, UBound and LBound gave me a compile error. In the second sheet, I want to be able to achieve along the lines of:

    Please Login or Register  to view this content.
    The only way I can do the above is if I set the range values on the second sheet which is not an option because I need to retain the values. I also tried setting the clipboard once I opened the second sheet using Range(strCellRange).Value as the value but the compiler through a wobbler.

    Any help would be GREATLY appreciated!!

    Cheers,
    JOhn

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Logic problem with Range values

    1. You really need to post the entire code.
    2. You used the word "worksheet" in your post. Did you mean workbook?
    3. Also, you seem to be trying to close the workbook from which the macro is running prior to opening your destination book. Er...no, no. You close the book/file containing the macro, the macro must stop; therefore, the message from the clipboard.
    4.
    strCellAddress = rCell.Address
    strCellAddress = rCell.Value
    Note that you load the string variable with a cell address, then immediately replace it with the value of the cell. What was your intent here?
    Ben Van Johnson

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Logic problem with Range values

    Hello ,

    In addition to Ben's suggestions, please change your title. Your title does not accurately reflect your question. Thread titles should be in a format suitable for database searches. I would suggest "How to copy range values from one worksheet to another"
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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