View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Activate a workbook?

Hi Terry,

Am Sun, 05 Mar 2017 08:07:48 +0000 schrieb Terry Pinnell:

https://dl.dropboxusercontent.com/u/...Copying-05.jpg


here is another suggestion. I guess it is more readable.
The ranges are not complete because it is only an example:

Sub CpoyTrackSheet()
Dim wbkS As Workbook, wbkD As Workbook
Dim wshS As Worksheet, wshD As Worksheet
Dim strS As String, strD As String
Dim varSource As Variant, varDest As Variant
Dim i As Integer

Set wbkS = Workbooks("TEST track sheet copying.xlsm")
Set wshS = wbkS.Sheets("Track Data")
Set wbkD = ThisWorkbook
Set wshD = wbkD.Sheets("TEMP")

strS = "B5,B10,B3,B13,B11,B12,B17,B18,B19,C17,C18"
varSource = Split(strS, ",")
strD = "C2,J2,E2,H2,I2,L2,T2,U2,V2,M2,X2"
varDest = Split(strD, ",")

With wshD
For i = LBound(varSource) To UBound(varSource)
.Range(varDest(i)) = wshS.Range(varSource(i))
.Range(varDest(i)).NumberFormat = wshS.Range(varSource(i)).NumberFormat
Next
End With
Application.Goto wshD.Range("A1")

End Sub


Regards
Claus B.
--
Windows10
Office 2016