+ Reply to Thread
Results 1 to 6 of 6

Assign entire row to variable, how do you paste variable values in a new workbook?

  1. #1
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Here
    MS-Off Ver
    Excel 2010
    Posts
    119

    Assign entire row to variable, how do you paste variable values in a new workbook?

    Syntax is killing me and I've been searching for a solution and can't find a thing. Or maybe it's just too late in the evening/early morning to have Excel VBA on the mind?!

    As the title says, I'm assigning an entire row of data to a variable via the following:
    Please Login or Register  to view this content.
    How do I paste the values stored in myRow say in Row 12 on another workbook. Up until now I have dealt with rows directly that are not assigned to variables. I'm sure it's simple... maybe my head is foggy?!

    Thanks

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Assign entire row to variable, how do you paste variable values in a new workbook?

    Please Login or Register  to view this content.
    or in extended version
    Please Login or Register  to view this content.
    shall do

    in this second case remember not to "copy data" this way between xlsx and xls books.
    Last edited by Kaper; 12-18-2013 at 02:12 AM.

  3. #3
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Here
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: Assign entire row to variable, how do you paste variable values in a new workbook?

    Kaper,

    That is so simple and yet seems convoluted to my brain right now. Thanks for clearing that up for me.

    One further question, how would you apply a paste special so as to control format of the pasted cells?

    Thanks very much,

    TV

  4. #4
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Here
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: Assign entire row to variable, how do you paste variable values in a new workbook?

    Does the variable store everything about the cell range? For example does it store the formatting of the cells? Is it possible to assign the format of the cells in the following way?
    Please Login or Register  to view this content.
    I've tried the above and it does not work but is there a way?

    Or for example can you assign the text values?
    Please Login or Register  to view this content.
    Last edited by tv69; 12-18-2013 at 10:54 AM.

  5. #5
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,613

    Re: Assign entire row to variable, how do you paste variable values in a new workbook?

    If you want to deal with formating it is pobably wiser use clipboard. So the sequence could be :

    Please Login or Register  to view this content.
    Or you could do the same this a range object:


    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    11-28-2013
    Location
    Here
    MS-Off Ver
    Excel 2010
    Posts
    119

    Re: Assign entire row to variable, how do you paste variable values in a new workbook?

    Ah, I see now. So clipboard is the way to go and that's where PasteSpecial comes in. I would never have thought you could use myRow.copy.

    Thanks again for clearing that up for me.

    Cheers,

    TV

+ 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. Cannot assign the calculated variable values to Graph
    By arvind68 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-20-2013, 08:21 AM
  2. [SOLVED] Copy/Paste Values from Variable Range to Corresponding Variable Range
    By Cpetersoc in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-14-2012, 08:20 AM
  3. assign variable name to the workbook
    By yjmmay34 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-17-2010, 02:18 AM
  4. Assign the name of the workbook to a variable?
    By syntex in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-04-2008, 07:26 AM
  5. Assign multiple cell's values to a variable
    By mikeburg in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2006, 01:50 PM

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