MainFile.xlsmDataSource.xls
Hi guys,
I wrote code to copy data from one workbook that is closed and I need to paste it on the next available blank row in the workbook I am working in called "dashboard Shell1", but I keep getting the error message "The information cannot be pasted because the copy area and the copy paste area are not the same size" This is because the sheet I am working on where the data will be pasted is using merged cells (need to stay merge) [view image]
002- DASHBOARD.PNG
the data come from one Column in this sheet...
002- DATASHEET.PNG
here's the code I used, the error I mention comes in at the pasting part
Public Sub RetrieveData()
'Retrieves Range A2:A100 from DHR Report and pastes it in Specified Range on Dashboard
Dim wbDash As Workbook 'workbook where the data is to be pasted
Dim wbData As Workbook 'workbook from where the data is to copied
'take off alerts to avoid Save As pop up
Application.ScreenUpdating = False
Set wbDash = ActiveWorkbook 'Dashboard
Set wbData = Workbooks.Open("C:\Users\673157897\Documents\Pro Fees Dash Board\Copy of RBC_CWM_DHR_Details_Report___Thomson__A (Preview).xls")
'select cell A1 on the target book
wbData.Sheets("Sheet1").Range("A2:A100").Copy
'paste the data on the Dashboard book
Dim lst As Long
lst = wbDash.Sheets("Data").Range("A" & Rows.Count).End(xlUp).Row + 1
wbDash.Sheets("Data").Range("A" & lst).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'clear any thing on clipboard to maximize available memory
Application.CutCopyMode = False
'takes off alerts
Application.DisplayAlerts = False
'close the data book
wbData.Close
'activate the Dashboard file
wbDash.Activate
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Please help someone!! Please
Bookmarks