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
 

NeonRedSharpie

Well-known Member
Joined
Jul 14, 2014
Messages
1,678
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
 

Forum statistics

Threads
1,082,250
Messages
5,364,020
Members
400,774
Latest member
Goldi paul

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top