PC Review


Reply
Thread Tools Rate Thread

Copying and pasting macro

 
 
Stav19
Guest
Posts: n/a
 
      8th Apr 2008
Hi all

I would like to copy and paste values from one sheet to another, I
wasn't sure how to paste certain parts from one spreadsheet to
another, so got around this by selecting everything and pasting it.

Example:

Select cells B1:C17, copy and paste in new sheet from cell A1. (this
bit was ok, and used a name range)

However my problem is then if I want to copy other cells and paste
them after the above,

eg

B21:C27 copying these and pasting them on the new sheet after the end
of the first paste. I've tried recording just this bit but when I
edited the macro it went a bit wrong...

Can anyone help with this?

thanks!!!
 
Reply With Quote
 
 
 
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      8th Apr 2008
Something like this maybe? Select the range you want to copy and then run
this macro...

Sub CopySelection()
Dim LastRow As Long
With Worksheets("Sheet2")
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
Selection.Copy Destination:=.Cells(LastRow, "A")
End With
End Sub

Change the Sheet2 reference to the name of the worksheet you want to copy
the current selection to.

Rick


"Stav19" <(E-Mail Removed)> wrote in message
news:ca57b79a-9d33-47d2-818f-(E-Mail Removed)...
> Hi all
>
> I would like to copy and paste values from one sheet to another, I
> wasn't sure how to paste certain parts from one spreadsheet to
> another, so got around this by selecting everything and pasting it.
>
> Example:
>
> Select cells B1:C17, copy and paste in new sheet from cell A1. (this
> bit was ok, and used a name range)
>
> However my problem is then if I want to copy other cells and paste
> them after the above,
>
> eg
>
> B21:C27 copying these and pasting them on the new sheet after the end
> of the first paste. I've tried recording just this bit but when I
> edited the macro it went a bit wrong...
>
> Can anyone help with this?
>
> thanks!!!


 
Reply With Quote
 
Stav19
Guest
Posts: n/a
 
      10th Apr 2008
On Apr 8, 2:45*pm, "Rick Rothstein \(MVP - VB\)"
<rick.newsNO.S...@NO.SPAMverizon.net> wrote:
> Something like this maybe? Select the range you want to copy and then run
> this macro...
>
> Sub CopySelection()
> * Dim LastRow As Long
> * With Worksheets("Sheet2")
> * * LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
> * * Selection.Copy Destination:=.Cells(LastRow, "A")
> * End With
> End Sub
>
> Change the Sheet2 reference to the name of the worksheet you want to copy
> the current selection to.
>
> Rick
>
> "Stav19" <pete.rebe...@gmail.com> wrote in message
>
> news:ca57b79a-9d33-47d2-818f-(E-Mail Removed)...
>
>
>
> > Hi all

>
> > I would like to copy and paste values from one sheet to another, I
> > wasn't sure how to paste certain parts from one spreadsheet to
> > another, so got around this by selecting everything and pasting it.

>
> > Example:

>
> > Select cells B1:C17, copy and paste in new sheet from cell A1. (this
> > bit was ok, and used a name range)

>
> > However my problem is then if I want to copy other cells and paste
> > them after the above,

>
> > eg

>
> > B21:C27 copying these and pasting them on the new sheet after the end
> > of the first paste. *I've tried recording just this bit but when I
> > edited the macro it went a bit wrong...

>
> > Can anyone help with this?

>
> > thanks!!!- Hide quoted text -

>
> - Show quoted text -


Thanks for your help rick, I'll try that and see how it goes!
 
Reply With Quote
 
Stav19
Guest
Posts: n/a
 
      10th Apr 2008
On Apr 8, 2:45*pm, "Rick Rothstein \(MVP - VB\)"
<rick.newsNO.S...@NO.SPAMverizon.net> wrote:
> Something like this maybe? Select the range you want to copy and then run
> this macro...
>
> Sub CopySelection()
> * Dim LastRow As Long
> * With Worksheets("Sheet2")
> * * LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
> * * Selection.Copy Destination:=.Cells(LastRow, "A")
> * End With
> End Sub
>
> Change the Sheet2 reference to the name of the worksheet you want to copy
> the current selection to.
>
> Rick
>
> "Stav19" <pete.rebe...@gmail.com> wrote in message
>
> news:ca57b79a-9d33-47d2-818f-(E-Mail Removed)...
>
>
>
> > Hi all

>
> > I would like to copy and paste values from one sheet to another, I
> > wasn't sure how to paste certain parts from one spreadsheet to
> > another, so got around this by selecting everything and pasting it.

>
> > Example:

>
> > Select cells B1:C17, copy and paste in new sheet from cell A1. (this
> > bit was ok, and used a name range)

>
> > However my problem is then if I want to copy other cells and paste
> > them after the above,

>
> > eg

>
> > B21:C27 copying these and pasting them on the new sheet after the end
> > of the first paste. *I've tried recording just this bit but when I
> > edited the macro it went a bit wrong...

>
> > Can anyone help with this?

>
> > thanks!!!- Hide quoted text -

>
> - Show quoted text -


Thanks for your help Rick, I'll give that a try and let you know how
it goes!
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copying and pasting with a macro Wombat Microsoft Excel Misc 1 4th Mar 2010 10:10 AM
Macro for Copying pasting between different spreadsheets Adnan Microsoft Excel Misc 4 21st Apr 2009 03:12 PM
Macro copying and pasting =?Utf-8?B?SmFtZXMgTw==?= Microsoft Excel Misc 0 24th Apr 2007 04:56 PM
Copying and Pasting Macro =?Utf-8?B?SnVyYXNzaWVu?= Microsoft Excel Misc 6 7th Feb 2007 11:57 PM
Simple copying and pasting macro =?Utf-8?B?SGVucmlr?= Microsoft Excel Programming 1 13th Jan 2005 11:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:11 PM.