LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
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

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA Code Not Working tictox Excel Discussion (Misc queries) 0 July 6th 10 06:40 PM
VB Code Is Not Working Rob Excel Discussion (Misc queries) 2 May 30th 07 05:23 PM
Vb Code not working bob Excel Programming 3 January 5th 04 01:29 PM
why this code not working Bernie Deitrick[_2_] Excel Programming 0 September 2nd 03 05:08 PM
For Each Code Not Working jacqui[_2_] Excel Programming 4 July 29th 03 02:44 AM


All times are GMT +1. The time now is 03:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"