View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_891_] joel[_891_] is offline
external usenet poster
 
Posts: 1
Default Set destination sheet based on variable and paste data assistance


try these changes

Sub Teamexports()

'Team1
with Thisworkbook.Sheets("Teamexports")
.Range("C3") = .Range("C5")
end with
Call Update_Data

Exit Sub

''Team2, etc etc,

--------------------------------------------------------------------------------------------

Sub Update_Data()

Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False
Application.DisplayAlerts = False

'collate the name of the files
Dim datestamp As String
Dim Namefile As String
Dim OpenName As String
Dim Summary As String

with thisworkbook
Summary = .Range("TeamData") & " Performance Model WC " & _
Format(.Range("WCDATA"), "dd_mm_yy") & ".xls"
datestamp = .Range("TeamData") & " Performance Model WC " & _
Format(.Range("WCDATA"), "dd_mm_yy")
'open the workbook
Namefile = .Range("TeamData")
OpenName = "\\ngclds06\manops\ams\Service\POM\" & _
Namefile& "\Performance Models\" & datestamp & ".xls"

Set Teambk = Workbooks.Open( Filename:=OpenName,
UpdateLinks:=False)
Call Update_Data2(Teambk)
end with
End Sub

--------------------------------------------------------------------------------------------

Sub Update_Data2(Teambk)

Dim Destsheet As String
with Thisworkbook
Set Destsheet = .Sheets("Daily Team Performance").Range("B4")

Dim rSource As Excel.Range
Dim rDestination As Excel.Range

Set rSource = Teambk.sheets("Daily Team
Performance").Range("B4:M103")
Set rDestination = .Sheets("Destsheet").Range("B4")

rSource.Copy
rDestination.PasteSpecial Paste:=xlPasteValues
end with


End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=195120

http://www.thecodecage.com/forumz