Thread
:
Copy/Paste Values code
View Single Post
#
13
Posted to microsoft.public.excel.programming
Mishell[_3_]
external usenet poster
Posts: 22
Copy/Paste Values code
This problem can be solved like this:
Sub CopySheets()
r = Sheets("Sheet2").UsedRange.Row
c = Sheets("Sheet2").UsedRange.Column
Sheets("Sheet2").UsedRange.Copy Sheets("Sheet3").Cells(r, c)
End Sub
Mishell
"Rick Rothstein" a écrit dans le
message de news:
...
Using the UsedRange might not be what the OP wants. If the UsedRange does
not start at A1, then using it in your code will move all the data up so
that the data starts in A1; using Cells as I proposed will keep the moved
data in the same cells they currently are in. Try this experiment with
both options to see the difference. Fill Sheet 1 with some data, then
select the first 5 rows and click Edit/Clear/All on the menu bar (do not
just hit the Delete key) to clear those cells from the UsedRange., then
run your code and watch where Row 6's data (and all the rows after it) end
up. Now repeat the process using my code.... Row 6 and all following rows
remain in the same rows they currently are in on Sheet2.
--
Rick (MVP - Excel)
"JLGWhiz" wrote in message
...
Might be a little faster.
Sub CopySheets()
Sheets("Sheet2").UsedRange.Copy Sheets("Sheet1").Range("A1")
End Sub
"Jules" wrote in message
...
Is there a faster way to copy and paste one entire worksheets data into
another existing worksheet? I do NOT want to rename the sheets. Code
below is
what I'm using now but it seems that there should be a simpler way.
Thanks!
Sub CopySheets()
Sheets("Sheet2").Select
Cells.Select
Selection.Copy
Sheets("Sheet1").Select
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
End Sub
Reply With Quote
Mishell[_3_]
View Public Profile
Find all posts by Mishell[_3_]