+ Reply to Thread
Results 1 to 9 of 9

How to copy specific cell values in worksheet to another worksheet in the same workbook?

  1. #1
    Registered User
    Join Date
    10-27-2014
    Location
    Coimbatore, India
    MS-Off Ver
    2007+2013
    Posts
    59

    How to copy specific cell values in worksheet to another worksheet in the same workbook?

    I hv a workbook with 3 sheets viz. OpgStk,Receipts,ClgStock
    In OpgStk and Receipts sheets, I have columns for ItemName ("K") and ItemLotNumber ("J"). There are about 1000 ItemNames and for each ItemName there are about 15 ItemLotNumbers in OpgStk and Receipts Sheets. I need to copy the ItemLotNumber from both the OpgStk and Receipts Sheets in the ClgStock Sheet. I have tried with the following but not successful. Of course, I have not considered Receipts Sheet in this as I thought once I get through with OpgStk and I can proceed to Receipts on the same lines. Data start from B7 and ends at P15007, with row 6 for column headers.

    Please Login or Register  to view this content.
    Any help?
    Last edited by alansidman; 10-27-2014 at 04:09 AM. Reason: code tags added

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,897

    Re: How to copy specific cell values in worksheet to another worksheet in the same workboo

    Code Tags Added
    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found at http://www.excelforum.com/forum-rule...rum-rules.html



    (Because you are new to the forum, I have added them for you today. Please take a few minutes to read all Forum Rules and comply in the future.)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,897

    Re: How to copy specific cell values in worksheet to another worksheet in the same workboo

    I think this is the problem area

    Please Login or Register  to view this content.
    I think it should be

    Please Login or Register  to view this content.
    Are you getting an error code, and if so, which line is highlighted and the message you receive?

  4. #4
    Registered User
    Join Date
    10-27-2014
    Location
    Coimbatore, India
    MS-Off Ver
    2007+2013
    Posts
    59

    Re: How to copy specific cell values in worksheet to another worksheet in the same workboo

    I have corrected the mistake but still not working. Runtime error 9 and the message is "Subscript out of range". No line is highlighted.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,897

    Re: How to copy specific cell values in worksheet to another worksheet in the same workboo

    Did you click on Debug after getting the error message?

    Look at this link. http://msdn.microsoft.com/en-us/libr...(v=vs.60).aspx
    Last edited by alansidman; 10-27-2014 at 04:40 AM.

  6. #6
    Registered User
    Join Date
    10-27-2014
    Location
    Coimbatore, India
    MS-Off Ver
    2007+2013
    Posts
    59

    Re: How to copy specific cell values in worksheet to another worksheet in the same workboo

    Thanks for the immediate response.
    It says "Object Variable or With block variable not set" for v=r.Value
    I just understood the importance of 'debugging" and I need to spend some time on this front.
    Regards.

  7. #7
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,897

    Re: How to copy specific cell values in worksheet to another worksheet in the same workboo

    Try changing this line of code

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    and see if that works for you.

  8. #8
    Registered User
    Join Date
    10-27-2014
    Location
    Coimbatore, India
    MS-Off Ver
    2007+2013
    Posts
    59

    Re: How to copy specific cell values in worksheet to another worksheet in the same workboo

    No luck........
    Now the error message is 1004 (Application defined or object defined error)
    There was an error in my code given to you and this has been modified as below:

    Please Login or Register  to view this content.
    I should say that col J in w1 is a calculated data, combining text values from two workbooks. I dont know whether this is causing any problem..
    I tried through another route by auto filtering and copying method. The code is:

    Please Login or Register  to view this content.
    I get the very same Runtime error with message number 9. Debugging, w1.Range(.....) and w2.Range(....) shows ""Object Variable or With block variable not set".
    The second method through filtering is not what I intended to do as it requires defining criteria range for n number of items. I want to be through with the first method.

    I just want to tell that I am a novice to VBA and putting my efforts to learn it. I cant figure out how to overcome so many errors with my little knowledge.

    I would be grateful for any help........Regards,
    Last edited by rviji.cbe; 10-27-2014 at 09:11 PM.

  9. #9
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,897

    Re: How to copy specific cell values in worksheet to another worksheet in the same workboo

    Don't have time to work on this tonight. Will try to evaluate tomorrow.

+ 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. How to copy data from one workbook to a specific worksheet of another workbook
    By VidyaVallaba in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-20-2014, 03:44 AM
  2. [SOLVED] Need to copy values from all files in folder from specific worksheet
    By jh51745 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 06-03-2013, 01:05 PM
  3. Copy Values from WorkSheet back to Another Workbook Replacing Values in Worksheet
    By bobwilson in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-03-2006, 04:50 PM
  4. Replies: 1
    Last Post: 03-16-2006, 03:00 PM
  5. Copy Worksheet to specific row in another workbook
    By GregR in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-28-2005, 03:05 PM

Tags for this Thread

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