View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
violet violet is offline
external usenet poster
 
Posts: 52
Default applying modules to mulitple worksheet

Bill,

The code you have for me is for all the worksheets in the workbook?what if i
wan only selected few?

"Bill Pfister" wrote:


Violet, you want to pass the worksheet(s) as a parameter into your sub.
Then you can call the sub from another routine and pass in the worksheets.
Here's an example:


public sub test_values_Master( )
dim wkb as workbook
dim wks as worksheet

set wkb = activeworkbook ' or set wkb equal to any workbook you want

for each wks in wkb.worksheets
call test_values( wks )
next wks
end sub


public sub test_values( wks as worksheet )
' perform operations on wks
end sub

Hope this helps - let me know if it wasn't what you were looking for.

Regards,
Bill


"violet" wrote:

i have written a sub test_values in modules named Identifychages. I know that
by runing the module it will perform the sub on the excel worksheet that i am
opening. however, i wish to run this sub on mulitiple worksheets on the same
workbook.how can i do it?anyone can give me advice? i still very new to vba
coding in excel.