Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default copy and paste

Hi,

Would anyone know how to write a vba code that does the following:

copies sheet1 (a1:a10)
pastes it to sheet2 (a1:a10)

copies sheet1 (b1:b10)
pastes it to sheet3 (a1:a10)

your help is greatly appreciated!


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default copy and paste


"Henrik" wrote in message
...
Hi,

Would anyone know how to write a vba code that does the following:

copies sheet1 (a1:a10)
pastes it to sheet2 (a1:a10)

copies sheet1 (b1:b10)
pastes it to sheet3 (a1:a10)

your help is greatly appreciated!



I believe this is what you want
/Fredrik

Sub MyCopy()
Sheets("Sheet1").Select
Range("A1:A10").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1:A10").Select
ActiveSheet.Paste

Sheets("Sheet1").Select
Range("B1:B10").Select
Selection.Copy
Sheets("Sheet3").Select
Range("A1:A10").Select
ActiveSheet.Paste
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default copy and paste

Or, another way:

Sub test4()
Sheets("Sheet1").Range("A1:A10").Copy Sheets("Sheet2").Range("A1:A10")
Sheets("Sheet1").Range("B1:B10").Copy Sheets("Sheet3").Range("A1:A10")
End Sub

Regards

Trevor


"Fredrik Wahlgren" wrote in message
...

"Henrik" wrote in message
...
Hi,

Would anyone know how to write a vba code that does the following:

copies sheet1 (a1:a10)
pastes it to sheet2 (a1:a10)

copies sheet1 (b1:b10)
pastes it to sheet3 (a1:a10)

your help is greatly appreciated!



I believe this is what you want
/Fredrik

Sub MyCopy()
Sheets("Sheet1").Select
Range("A1:A10").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A1:A10").Select
ActiveSheet.Paste

Sheets("Sheet1").Select
Range("B1:B10").Select
Selection.Copy
Sheets("Sheet3").Select
Range("A1:A10").Select
ActiveSheet.Paste
End Sub




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default copy and paste

Hi Henrik,

Sub Tester()
Sheets("Sheet1").Range("A1:A10").Copy
ActiveSheet.Paste Destination:=Sheets("Sheet2").Range("A1")

Sheets("Sheet2").Range("B1:B10").Copy
ActiveSheet.Paste Destination:=Sheets("Sheet3").Range("A1")
Application.CutCopyMode = False

End Sub

---
Regards,
Norman



"Henrik" wrote in message
...
Hi,

Would anyone know how to write a vba code that does the following:

copies sheet1 (a1:a10)
pastes it to sheet2 (a1:a10)

copies sheet1 (b1:b10)
pastes it to sheet3 (a1:a10)

your help is greatly appreciated!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
Copy; Paste; Paste Special are disabled Mack Neff[_3_] Excel Discussion (Misc queries) 0 April 28th 08 06:29 PM
Excel cut/Paste Problem: Year changes after data is copy and paste Asif Excel Discussion (Misc queries) 2 December 9th 05 05:16 PM
I cannot paste from one workbook to another. Copy works, paste do. JimmyMc Excel Discussion (Misc queries) 1 June 10th 05 03:54 PM
Macro to Copy/Paste then Paste to Next Line tomkarakowski Excel Programming 1 May 28th 04 01:19 AM


All times are GMT +1. The time now is 12:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"