View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
joel[_593_] joel[_593_] is offline
external usenet poster
 
Posts: 1
Default Passing a range between two subroutines.


The workbook open occurs before the worksheet change will take affect.

If you want to use the same code for both the worksheet open and a
change event then create a new subroutine in the module and call the new
routine from both the open and change events. You can pass a range to
the new subroutine


sub wokbook open

set MyRange = Sheet("sheet1").range("A1")
call common_sub(MyRange)
end sub
---------------------------------------
sub change event (target)

call common_sub(target)

end sub
-----------------------------------------

new sub in a module
sub common_sub(MyRange as Range)

put common code here

end sub


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

Microsoft Office Help