View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel[_923_] joel[_923_] is offline
external usenet poster
 
Posts: 1
Default moved code to new book - some doesn't work now


When you have a statement like this

With Worksheets("Sheet1")

It is using the activeworkbook. Since you have two workbooks that are
opened you are probably accessing the wrong workbook. if you are
refereing to the workbook where the macro is located use Thisworkbook

With Thisworkbook.Worksheets("Sheet1")


You may also want to pass as a parameter to the macro the workbook name

Application.Run "'Book2'!Macro1" "Book1"


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=198367

http://www.thecodecage.com/forumz