Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Call a function in some sheets

Hello all

I'm creating a code in sheet1, it works fine, but now I need to use the same
code in sheet2 without write again the code.
Also I need to change the name Sheet1 for another name.
In other words, I need a code that can runs in any sheet.

Thanks for your time and sugestions.
henpat
(Excel 2003 SP2)
Call a function in some sheets


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Call a function in some sheets

Take the main code out and put in a public sub in a standard code module,
with an argument of sh. Change references to the worksheet to sh.

Then in the worksheet code use

myMacro Me

myMacro would look something like

Sub myMacro (sh As Worksheet)
With sh
...
End With
End Sub

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"henpat" wrote in message
...
Hello all

I'm creating a code in sheet1, it works fine, but now I need to use the

same
code in sheet2 without write again the code.
Also I need to change the name Sheet1 for another name.
In other words, I need a code that can runs in any sheet.

Thanks for your time and sugestions.
henpat
(Excel 2003 SP2)
Call a function in some sheets




Reply
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
Is there a do not call function? pokdbz Excel Discussion (Misc queries) 2 December 27th 07 04:00 PM
Can you call functions between sheets in the same book in excel? Arenlor Excel Worksheet Functions 3 January 7th 06 03:21 AM
Call Sub from Function? G Lykos Excel Programming 1 November 23rd 05 06:48 AM
How do I call this function? vrk1 Excel Programming 1 June 18th 05 01:05 AM
Function Call Phil Hageman Excel Programming 4 October 9th 03 04:32 PM


All times are GMT +1. The time now is 06:56 PM.

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"