ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Redundant (https://www.excelbanter.com/excel-programming/371231-redundant.html)

Striker

Redundant
 
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)



Tom Ogilvy

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)





All times are GMT +1. The time now is 05:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com