I need to create a macro that will copy information in specific cells, then paste it into specific cells in another workbook? Is this possible?

Catlover22

New Member
Joined
Apr 27, 2016
Messages
5
The workbook that I am starting in is called "Rachael"
The workbook that I am trying to copy into is called "Jessica"
This workbook has two tabs that I need to paste into
“Summary” and “Summary Fall”
The range that I need to copy the information into is:
X 8:61 - "Summary"
Breaks at the end of rows: 14, 20, 26, 31, 33, 37, 41, 49, 61


X 8:61 - "Summary Fall"
Breaks at the end of rows: 14, 23, 30, 36, 40, 45, 50, 62

The breaks mean that individual sections of ranges have to be copied into individual sections within X 8:61
(i.e. I have data in one workbook range A1:4. I need to copy it into another workbook but there is a break at the end of row 2, and a TOTAL row is there, so I need to fill the remaining A3 and A4 into the line that comes AFTER the TOTAL row)


Below is what I have (I just recorded it, I did not try to write it) but it does not copy it to the other workbook.
The first macro "CopyFormulas2" includes the range of data that I need to copy. This is a separate macro that does work correctly, I just included it in here so that you guys could see the specific ranges that I needed to copy into the other workbook.


Sub CopyFormulas2()
'
' CopyFormulas2 Macro
'

'
Selection.AutoFill Destination:=Range("D6:D12"), Type:=xlFillDefault
Range("D6:D12").Select
Range("G7").Select
Selection.AutoFill Destination:=Range("G7:G12"), Type:=xlFillDefault
Range("G7:G12").Select
Range("G8").Select
Selection.AutoFill Destination:=Range("G6:G8"), Type:=xlFillDefault
Range("G6:G8").Select
Range("D14").Select
Selection.AutoFill Destination:=Range("D14:D23"), Type:=xlFillDefault
Range("D14:D23").Select
Range("G16").Select
Selection.AutoFill Destination:=Range("G16:G23"), Type:=xlFillDefault
Range("G16:G23").Select
Range("G16").Select
Selection.AutoFill Destination:=Range("G14:G16"), Type:=xlFillDefault
Range("G14:G16").Select
ActiveWindow.SmallScroll Down:=15
Range("D29").Select
Selection.AutoFill Destination:=Range("D29:D37"), Type:=xlFillDefault
Range("D29:D37").Select
Range("D29").Select
Selection.AutoFill Destination:=Range("D25:D29"), Type:=xlFillDefault
Range("D25:D29").Select
Range("G28").Select
Selection.AutoFill Destination:=Range("G28:G37"), Type:=xlFillDefault
Range("G28:G37").Select
Range("G28").Select
Selection.AutoFill Destination:=Range("G25:G28"), Type:=xlFillDefault
Range("G25:G28").Select
ActiveWindow.SmallScroll Down:=12
Range("D43").Select
Selection.AutoFill Destination:=Range("D43:D52"), Type:=xlFillDefault
Range("D43:D52").Select
Range("D43").Select
Selection.AutoFill Destination:=Range("D39:D43"), Type:=xlFillDefault
Range("D39:D43").Select
Range("G46").Select
Selection.AutoFill Destination:=Range("G46:G52"), Type:=xlFillDefault
Range("G46:G52").Select
Range("G46").Select
Selection.AutoFill Destination:=Range("G39:G46"), Type:=xlFillDefault
Range("G39:G46").Select
Range("D57").Select
Selection.AutoFill Destination:=Range("D57:D65"), Type:=xlFillDefault
Range("D57:D65").Select
Range("D57").Select
Selection.AutoFill Destination:=Range("D54:D57"), Type:=xlFillDefault
Range("D54:D57").Select
Range("G59").Select
Selection.AutoFill Destination:=Range("G59:G65"), Type:=xlFillDefault
Range("G59:G65").Select
Range("G59").Select
Selection.AutoFill Destination:=Range("G54:G59"), Type:=xlFillDefault
Range("G54:G59").Select
ActiveWindow.SmallScroll Down:=-60
Range("D6").Select
End Sub



(this is the one that I am really interested in knowing how to do)

Sub CopyIntoCatTool()
'
' CopyIntoCatTool Macro
'

'
Range("D6:D12").Select
Application.CutCopyMode = False
Selection.Copy
Range("D14:D19").Select
Application.CutCopyMode = False
Selection.Copy
Range("D25:D35").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=15
Range("D39:D48").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=9
Range("D54:D61").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=15
Range("D67:D78").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=-48
Range("G6:G12").Select
Application.CutCopyMode = False
Selection.Copy
Range("G14:G22").Select
Application.CutCopyMode = False
Selection.Copy
Range("G25:G37").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=12
Range("G39:G52").Select
Application.CutCopyMode = False
Selection.Copy
ActiveWindow.SmallScroll Down:=21
Range("G54:G65").Select
Application.CutCopyMode = False
Selection.Copy
Application.CutCopyMode = False
End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
The basics of the code are as follows:

Code:
Sub copyBetweenBooks()



    Dim rach As Workbook
    Dim jess As Workbook
    
    Set rach = Workbooks("Rachel.xls")
    Set jess = Workbooks("Jessica.xls")
    
    Dim rSum As Worksheet
    Dim jFal As Worksheet
    
    Set rSum = rach.Sheets("Summary")
    Set jFal = jess.Sheets("Summary Fall")
    
    With rSum
              
        jFal.Range("A1").Value = rSum.Range("A1")
              
    End With
    
    
    


End Sub
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top