View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
BrianB BrianB is offline
external usenet poster
 
Posts: 1
Default Code is working in one file but not in another.

Sorry - most of us do not download files.
You will probably need to copy/paste your code.
Bear in mind that the error may not be in the code itself but in th
availability of the ranges/sheets etc.

The biggest cause of error here is "lazy programming", wher
worksheets/ranges are not explicitly or fully coded eg :-

'--------------------------------------------------------------------------------
MyValue
Workbooks("Book1.xls").WorkSheets("Sheet1").Range( "A1").Value
'--------------------------------------------------------------------------------
where this would save a lot of typing :-
Dim MySheet as WorkSheet
Set MySheet = Workbooks("Book1.xls").WorkSheets("Sheet1")
'--------------------------------------------------------------------------------

As you progress in writing code, you should be using this metho
instead of "Select" unless you actually need to see something in
worksheet

--
Message posted from http://www.ExcelForum.com