K
Karen
The portion of code below courtesy of Debra Dalgliesh(thanks again)
pastes data into cells B1:Z1.
The problem I have is that it will overwrite existing data. I realise
that the destination cells need testing and if data exists prompt the
user (by messagebox?) for confirmation to overwrite/cancel.
I would appreciate any help in achieving this.
For Each ws In wbMaster.Worksheets
strEmp = ws.Name
For Each ws2 In wbMth.Worksheets
If IsError(Application.Match(strEmp, _
ws2.Range("B1:Z1"), 0)) Then
'do nothing
Else
col = Application.Match(strEmp, _
ws2.Range("B1:Z1"), 0)
ws2.Range(ws2.Cells(2, col + 1), _
ws2.Cells(LastRow, col + 1)).Copy _
Destination:=ws.Cells(2, i + 1)
Exit For
End If
Next
TIA
Karen
pastes data into cells B1:Z1.
The problem I have is that it will overwrite existing data. I realise
that the destination cells need testing and if data exists prompt the
user (by messagebox?) for confirmation to overwrite/cancel.
I would appreciate any help in achieving this.
For Each ws In wbMaster.Worksheets
strEmp = ws.Name
For Each ws2 In wbMth.Worksheets
If IsError(Application.Match(strEmp, _
ws2.Range("B1:Z1"), 0)) Then
'do nothing
Else
col = Application.Match(strEmp, _
ws2.Range("B1:Z1"), 0)
ws2.Range(ws2.Cells(2, col + 1), _
ws2.Cells(LastRow, col + 1)).Copy _
Destination:=ws.Cells(2, i + 1)
Exit For
End If
Next
TIA
Karen