LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #11   Report Post  
bigdaddy3
 
Posts: n/a
Default

Hi Duke,since i last spoke i have used the attached code nd it all copied
perfect when the payslip workbook opened but it seemed to blink 4 times am i
on the right track as i would rather not use another button but could i use
your code with a macro in the open event or can my code be simplified as far
as just one event


Workbooks("Staff Details").Activate
Range("I4:I10").Select
Selection.Copy
Worksheets("Payslip").Activate
Range("B2:B8").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Workbooks("Staff Details").Activate
Range("C4").Select
Selection.Copy
Worksheets("Payslip").Activate
Range("C11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Workbooks("Staff Details").Activate
Range("C9").Select
Selection.Copy
Worksheets("Payslip").Activate
Range("K11").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

Workbooks("Staff Details").Activate
Range("G9").Select
Selection.Copy
Worksheets("Payslip").Activate
Range("K12").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

--
BD3


"Duke Carey" wrote:

Put this in your Staff Details workbook & attach it to a button that you
click on after you've opened the wages.xls file

Sub CopyPayslipData()
Dim wsDetails As Worksheet
Dim wsSlips As Worksheet

Set wsDetails = activesheet
Set wsSlips = workbooks("Wages.xls").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:

Hi Duke,hows this i have a workbook open (staff Details) on that there are
various buttons 1 of which calls up a workbook (Wages) with an active
worksheet (Payslip) onto which i need to copy certain details from the
original workbook (Staff Details). the ranges to be copied from are (I4:I10)
("C4") ("C9") ("G9") they then have to be pasted to("B2:B8", "C11", "K11",
"K12") in that order they are all seperate items,does that make more sense
--
BD3
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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Copy and Paste or Paste Special between Excel Workbooks wllee Excel Discussion (Misc queries) 5 April 29th 23 03:43 AM
copy and paste using code from workbook to workbook bigdaddy3 Excel Discussion (Misc queries) 2 September 14th 05 11:06 AM
copy paste nowfal Excel Discussion (Misc queries) 1 September 3rd 05 01:30 AM
I cannot paste from one workbook to another. Copy works, paste do. JimmyMc Excel Discussion (Misc queries) 1 June 10th 05 03:54 PM
Can't Copy and Paste between Excel 2003 Workbooks wllee Excel Discussion (Misc queries) 6 March 30th 05 02:59 PM


All times are GMT +1. The time now is 05:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"