Hi,
With the below code, I'm trying to select a particular range ("A21:LR") and paste that into another sheet the same range at A21. But for some reasons I cannot connect to the particular range. Can anyone please look into this?
With the below code, I'm trying to select a particular range ("A21:LR") and paste that into another sheet the same range at A21. But for some reasons I cannot connect to the particular range. Can anyone please look into this?
Code:
For Each wsData In wbData.Worksheets 'cycle through the sheets
Set wsMain = wbMain.Sheets(wsData.Name) 'try to match the sheetnames
If Not wsMain = Array("sheet1", "sheet2") Then 'only proceed if a matching sheetname was found
NR = wsMain.Range("A" & Rows.Count).End(xlUp).Row + 1 'next empty row
With wsData 'measure the used rows then copy
LR = .Range("A" & .Rows.Count).End(xlUp).Row
.Range("A2:A" & LR).EntireRow.Copy wsMain.Range("A" & NR)
End With
Set wsMain = Nothing
End If
Next wsData