View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
fishy fishy is offline
external usenet poster
 
Posts: 39
Default Paste copied data to specified sheet based on range - variable

This has allowed a progression but now I am getting an error:

'Run time error 1004':
Method 'Range' of object' _Global' failed

This occurs at line:
Destsheet = Range("Daily Team Performance!B4")

The only thing I can think of is that the 'Daily team performance' is in a
variable workbook that is opened and is the active book using the following
code:

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

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"

Workbooks.Open Filename:=OpenName, UpdateLinks:=False

Call Update_Data2

End sub

Do I need to refer back to these variables for the sheets?

R