Thread: Redundant
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Redundant

Set WB = Workbooks("Template_CK Ordered.xls")
Set SH = WB.Sheets("CO_Template")
Set rDestCell = SH.Range("A2")

Set wkbkCSV = Workbooks.Open(Filename:=sFile1)

You don't need the WB in the 3rd line. SH already knows it belongs to WB.

--
Regards,
Tom Ogilvy




"Striker" wrote:

The third line does not work, so I commented it out and am using the 4th
line, but this seems a little redundant to me. What is wrong with it.


Set WB = Workbooks("Template_CK Ordered.xls")
Set SH = WB.Sheets("CO_Template")
'Set rDestCell = WB.SH.Range("A2")
Set rDestCell = Workbooks("Template_Ck
Ordered.xls").Worksheets("CO_Template").Range("A2" )
Set wkbkCSV = Workbooks.Open(Filename:=sFile1)