+ Reply to Thread
Results 1 to 7 of 7

How can I paste value from a variable with Destination:=

  1. #1
    Registered User
    Join Date
    11-10-2007
    Location
    Sweden
    Posts
    32

    How can I paste value from a variable with Destination:=

    I have a macro that copy values from sheets to a summary sheet (OutSh)

    For that I use this line, as an example:

    Please Login or Register  to view this content.
    That is working fine, but how can I take the value from a String variable, Temp2 and "paste" it the same way?

    I want to use this method.
    Please Login or Register  to view this content.
    Thanks
    Last edited by VBA Noob; 08-12-2008 at 01:15 PM.

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Please Login or Register  to view this content.
    So Assume Temp2 = 10 it would paste to Cell A10

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    You mean?
    Please Login or Register  to view this content.
    Without know the value of Temp2, it is hard to know what you mean. Copying the Value and pasting are two different things.

  4. #4
    Registered User
    Join Date
    11-10-2007
    Location
    Sweden
    Posts
    32
    Quote Originally Posted by VBA Noob
    Maybe

    Please Login or Register  to view this content.
    So Assume Temp2 = 10 it would paste to Cell A10

    VBA Noob
    Thank you for your replay VBA Noob
    But If I want to include this part where that counts the rows to the last used row, Cells(rows.Count, 1).End(xlUp)

    Is that possible?

  5. #5
    Registered User
    Join Date
    11-10-2007
    Location
    Sweden
    Posts
    32
    Quote Originally Posted by Kenneth Hobson
    You mean?
    Please Login or Register  to view this content.
    Without know the value of Temp2, it is hard to know what you mean. Copying the Value and pasting are two different things.
    I only want to paste the value in Temp2, not copy values to it. And the variable Temp2 is a "long", containing numbers.

  6. #6
    Registered User
    Join Date
    11-10-2007
    Location
    Sweden
    Posts
    32
    I'm not sure I explained so you guys understood what I wanted with the code.

    It is like this.
    I have created a variable (long) called Temp2.
    Temp2 is used to store numbers created by a nother procedure. That is working fine and is nothing I need help with here. What I need help with is how can I put this number that is stored in the Temp2 variable into the sheet (OutSh). Can it be done using the same method as described above with the (Destination:=) method? It would be great if it could check for the last row, just like the code above does and put it there and use the offset to select column, like the code below (although that code use range as input instead of Temp2)

    Please Login or Register  to view this content.
    Thanks for you help, I understand now that I did not explain well enough before what I wanted the code to do.

  7. #7
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573
    You first said that Temp2 was a string. Now, you say it is a long. In anycase, the solution is the same.

    I gave you the solution providing that your code on the left is what you wanted.
    Please Login or Register  to view this content.
    Had you wanted to put a cell value into temp2 then swap the values:
    Please Login or Register  to view this content.
    You can use this to test where your code on the left is pointing to by:

    Please Login or Register  to view this content.

+ 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