Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 102
Default How to transfer a range from sheet to sheet?

Ok, there should be 3 panes here, the one on the top left should have
a folder titled: "Modules". Right click and select "Insert"---
Module.


Now the pane on the right should be completely blank, (the big one).
Copy the following code and paste it into this pane.

-----------------------------------------------Start Copying Just
Below This Line-----------------------------------------

Sub CustomPaste()

Dim CopySheet As Worksheet
Dim PasteSheet As Worksheet
Dim CurRng As Range
Dim CopyRng As Range 'Not used, future improvement
Dim PasteRng As Range 'Not used, future improvement

On Error GoTo ErrCustomPaste

'Hold the currently selected cell to return to at end of routine
Set CurRng = Application.ActiveCell
'Hold the values of the sheets to be used in variables (improve
performance)
Set CopySheet = Sheets("Sheet1")
Set PasteSheet = Sheets("Sheet2")

'Freeze the screen to improve performance
Application.ScreenUpdating = False
'Copy and Paste the information
With CopySheet
.Select
.Range("A1:A2").Copy PasteSheet.Range("B1:B2")
End With
With CopySheet
.Select
.Range("A3:A4").Copy PasteSheet.Range("C10:C11")
End With
With CopySheet
.Select
.Range("A5:A6").Copy PasteSheet.Range("D1:D2")
End With
'Return to the originally selected cell
CurRng.Select
'Refresh the screen to update changes
Application.ScreenUpdating = True
Exit Sub

ErrCustomPaste:
MsgBox "An unknown error ocurred within the CustomPaste
procedure.", vbExclamation, _
"Custom Paste Abort!"
CurRng.Select
Application.ScreenUpdating = True
End Sub

-----------------------------------------------Stop Copying Just Above
This Line-----------------------------------------

Save your workbook now!

Now go back to the Excel Window and select: Tools...Macro---Macros

There should be a window that appears with an option to run
"CustomPaste"

Select it and click Run

If you cannot, then more than likely, we will have to change your
Macro Security Settings before we continue...

Lemme know how it goes...


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
How can I transfer a required data from sheet 1 to sheet 2 automat Malik Nadeem Excel Discussion (Misc queries) 6 October 24th 07 11:48 AM
how to transfer data from sheet to sheet with new range? Jon Excel Discussion (Misc queries) 6 August 20th 07 06:36 PM
How to transfer text to an sheet if the cells en range contains a mia_kit Excel Discussion (Misc queries) 2 May 24th 07 04:40 PM
How to Automatically transfer specific Data from Sheet 1 to Sheet Jman Excel Worksheet Functions 12 May 10th 07 05:35 AM
Transfer/Copy Sheet, Dynamically linked Sheet 0-0 Wai Wai ^-^ Excel Discussion (Misc queries) 2 December 23rd 05 10:04 PM


All times are GMT +1. The time now is 07:33 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"