Application.CutCopyMode = False
will get rid of the range border that indicates you have copied that range
The code you had in your original post will copy data from whatever sheet in
the Staff Details workbook is active when you open the workbook containing
the code. It'd be better to set a worksheet variable to the specific sheet
you want to use as the source, as my sample code did
"bigdaddy3" wrote:
Hi Duke, it was workbooks named Staff details and what about the last point i
mentioned about clearing the outline when finished,Thanks for your reply
--
BD3
"Duke Carey" wrote:
Do you really mean WORKBOOKS(Staff Details")? or should that be WORKSHEETS?
Maybe this will work for you
Private Sub Workbook_Open()
Dim wsDetails As Worksheet
Dim wsSlips As Worksheet
Set wsDetails = Worksheets("Staff Details")
Set wsSlips = Worksheets("Payslips")
With wsDetails
.Range("I4:I10").Copy
wsSlips.Range("B2:B8").PasteSpecial xlPasteValues
.Range("C4").Copy
wsSlips.Range("C11").PasteSpecial xlPasteValues
.Range("C9").Copy
wsSlips.Range("K11").PasteSpecial xlPasteValues
.Range("G9").Copy
wsSlips.Range("K12").PasteSpecial xlPasteValues
End With
End Sub
"bigdaddy3" wrote:
can somone tell me why the attached code will not work it works for the first
range only but when others added it fails also how do you clear outline of
copied cells, i used range ("D9").Select but no good.Could someone help
please
-- Private Sub Workbook_Open()
Workbooks("Staff Details").Activate
Range("I4:I10")("C4")("C9")("G9").Select
Selection.Copy
Worksheets("Payslip").Activate
Range("B2:B8", "C11", "K11", "K12").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("D9").Select
End Sub
BD3
|