I have a macro that copy values from sheets to a summary sheet (OutSh)
For that I use this line, as an example:
That is working fine, but how can I take the value from a String variable, Temp2 and "paste" it the same way?Range("B2").Copy Destination:=OutSh.Cells(rows.Count, 1).End(xlUp).Offset(1, 1)
I want to use this method.ThanksDestination:=OutSh.Cells(rows.Count, 1).End(xlUp).Offset(1, 1)![]()
Last edited by VBA Noob; 08-12-2008 at 01:15 PM.
Maybe
So Assume Temp2 = 10 it would paste to Cell A10Destination:=OutSh.Cells(Temp2,1)
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 !!!
You mean?
Without know the value of Temp2, it is hard to know what you mean. Copying the Value and pasting are two different things.OutSh.Cells(rows.Count, 1).End(xlUp).Offset(1, 1).Value = Temp2
Thank you for your replay VBA NoobOriginally Posted by 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?
I only want to paste the value in Temp2, not copy values to it. And the variable Temp2 is a "long", containing numbers.Originally Posted by Kenneth Hobson
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)
Thanks for you help, I understand now that I did not explain well enough before what I wanted the code to do.Range("B2").Copy Destination:=OutSh.Cells(rows.Count, 1).End(xlUp).Offset(1, 1)
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.
Had you wanted to put a cell value into temp2 then swap the values:OutSh.Cells(rows.Count, 1).End(xlUp).Offset(1, 1).Value = Temp2
You can use this to test where your code on the left is pointing to by:Temp2 = OutSh.Cells(rows.Count, 1).End(xlUp).Offset(1, 1).Value
MsgBox OutSh.Cells(rows.Count, 1).End(xlUp).Offset(1, 1).Address
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks