Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Apply code to other worksheets


I have a master sheet that will have some additional sheets
modified at various times. I want to have all my code saved in the
master sheet and applied to the other sheets from there. For example:
I want to have the following code saved in the "master" sheet but
applied to "invoice"
sheet.

mytext = "ALMFG: AL MFG TAX"
For a = 1 To 999
If Cells(a, "c") = mytext Then Cells(a, "m") = Cells(a, "e")
Next a
mytext = "SHMFG: SHELBY CO MFG TAX"
For s = 1 To 999
If Cells(s, "c") = mytext Then Cells(s, "l") = Cells(s, "e")
Next s
mytext = "PEMFG: PELHAM MFG TAX"
For p = 1 To 999
If Cells(p, "c") = mytext Then Cells(p, "j") = Cells(p, "e")
Next p
mytext = "HEMFG: HELENA MFG TAX"
For h = 1 To 999
If Cells(h, "c") = mytext Then Cells(h, "k") = Cells(h, "e")
Next h

How can I achieve this?


Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=515726

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Apply code to other worksheets

if you want to provie it in one workbook, put it in a global sub in the
workbook-code.
if you want to provide it for n workbooks, create an add-in

"Metrazal" wrote:


I have a master sheet that will have some additional sheets
modified at various times. I want to have all my code saved in the
master sheet and applied to the other sheets from there. For example:
I want to have the following code saved in the "master" sheet but
applied to "invoice"
sheet.

mytext = "ALMFG: AL MFG TAX"
For a = 1 To 999
If Cells(a, "c") = mytext Then Cells(a, "m") = Cells(a, "e")
Next a
mytext = "SHMFG: SHELBY CO MFG TAX"
For s = 1 To 999
If Cells(s, "c") = mytext Then Cells(s, "l") = Cells(s, "e")
Next s
mytext = "PEMFG: PELHAM MFG TAX"
For p = 1 To 999
If Cells(p, "c") = mytext Then Cells(p, "j") = Cells(p, "e")
Next p
mytext = "HEMFG: HELENA MFG TAX"
For h = 1 To 999
If Cells(h, "c") = mytext Then Cells(h, "k") = Cells(h, "e")
Next h

How can I achieve this?


Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=515726


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Apply code to other worksheets


You only have to activate the desire worksheet, for example:

Sheets("invoice").activate

or if you want to activate by its codename:

sheet3.activate

rgds.


--
dbarelli
------------------------------------------------------------------------
dbarelli's Profile: http://www.excelforum.com/member.php...o&userid=31275
View this thread: http://www.excelforum.com/showthread...hreadid=515726

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Apply code to other worksheets


I could not get the Sheets("Sjournal").Activate to work.
Please explain how I would do an add-in or another method.

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=515726

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Apply code to other worksheets

sub test()
mytext = "ALMFG: AL MFG TAX"
For a = 1 To 999
If ActiveWorkbook.Sheets.Cells(a, "c") = mytext Then
ActiveWorkbook.Sheets.Cells(a, "m") = ActiveWorkbook.Sheets.Cells(a, "e")
end if
Next a
....
endsub

"Metrazal" wrote:


I could not get the Sheets("Sjournal").Activate to work.
Please explain how I would do an add-in or another method.

Thanks,

Met


--
Metrazal
------------------------------------------------------------------------
Metrazal's Profile: http://www.excelforum.com/member.php...o&userid=31648
View this thread: http://www.excelforum.com/showthread...hreadid=515726




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
Apply to all worksheets Brandi Excel Discussion (Misc queries) 0 November 14th 09 04:31 PM
How to apply headings to all worksheets bill Excel Discussion (Misc queries) 3 December 24th 05 11:30 AM
Won't apply to all worksheets G Setting up and Configuration of Excel 1 November 28th 05 05:56 PM
run code on opening workbook and apply code to certain sheets Jane Excel Programming 7 August 8th 05 09:15 AM
How apply one action to all worksheets? Doria/Warris Excel Programming 5 June 15th 04 04:32 AM


All times are GMT +1. The time now is 10:06 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"