radka.silva
04-29-2015, 08:48 AM
Hello,
I am cutting some data from one spreadsheet and pasting in another spreadsheet and would like to make this repetative task more automated. The code that I have so far is working, but only cuts and pastes the first four rows; what am I missing? Here is my code:
Sub CopyAUM()
Dim wbPortfolio As Workbook, wsMaster As Workbook, wb As Workbook
For Each wb In Application.Workbooks
If wb.Name Like "4-15 AUM_LCV*" Then
Set wbAUM = wb
ElseIf wb.Name Like "DOWNLOAD*" Then
Set wsDownload = wb
End If
Next
lastRow = Range("A" & Rows.Count).End(xlUp).Row
Call wsDownload.ActiveSheet.Range("A2:H" & lastRow).Copy(wbAUM.ActiveSheet.Range("A6"))
End Sub
I have to note that I have spliced this code from my other iqueries on this forum without a full understanding of how it works. :(
I am working with Excel 2010.
Thanks!
I am cutting some data from one spreadsheet and pasting in another spreadsheet and would like to make this repetative task more automated. The code that I have so far is working, but only cuts and pastes the first four rows; what am I missing? Here is my code:
Sub CopyAUM()
Dim wbPortfolio As Workbook, wsMaster As Workbook, wb As Workbook
For Each wb In Application.Workbooks
If wb.Name Like "4-15 AUM_LCV*" Then
Set wbAUM = wb
ElseIf wb.Name Like "DOWNLOAD*" Then
Set wsDownload = wb
End If
Next
lastRow = Range("A" & Rows.Count).End(xlUp).Row
Call wsDownload.ActiveSheet.Range("A2:H" & lastRow).Copy(wbAUM.ActiveSheet.Range("A6"))
End Sub
I have to note that I have spliced this code from my other iqueries on this forum without a full understanding of how it works. :(
I am working with Excel 2010.
Thanks!