Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Running Two Macros as One

I have to Macros. The first one will copy data from one sheet and
paste it to another. The second one will then change the data in
certain cells to the proper Month Name.

What I would like to do is have one macro for each month. After it
inputs the proper month name, it then runs the copy and paste macro.
Is there a way to do this???

Any help is MUCH appreciated!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Running Two Macros as One

First Module:

Public Sub CopyPaste()

'
Sheets("Forecast Report").Select 'Copies Total Yards from
currenct Forecast and pastes
Range("E105").Select 'to LST FRCST PRDCT
Total for the new Forecast Report
Selection.Copy
Range("AL105").PasteSpecial xlPasteValues




End Sub

Second Module:

Sheets("Worksheet").Select
'Pastes "January" in Month headers
Range("B4").Select
ActiveCell.FormulaR1C1 = "January"
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Sheets("Forecast Report").Select
Range("B3").Select
ActiveCell.FormulaR1C1 = "January"
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Range("B4:B6").Select
End Sub

I need to run one module and then the other. The order doesn't matter.
However, I will have 12 modules similar to module 2, one for each
month. I don't want to just paste the code from module 1 into two
because I will be adding to it later.
Jim Thomlinson wrote:
Post your code...
--
HTH...

Jim Thomlinson


"cheeser83" wrote:

I have to Macros. The first one will copy data from one sheet and
paste it to another. The second one will then change the data in
certain cells to the proper Month Name.

What I would like to do is have one macro for each month. After it
inputs the proper month name, it then runs the copy and paste macro.
Is there a way to do this???

Any help is MUCH appreciated!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Running Two Macros as One

Thank You! I figured out what I was doing wrong in the second module
with your help with it. I was not putting the Call CopyPaste within
the same Sub routine.

As far as shortening my code goes, I will try that out also. Thank you
for the help!

Jim Thomlinson wrote:
Try this... Your code can be really shortened up a whole pile...

Public Sub CopyPaste()
With Sheets("Forecast Report")
.Range("AL105").Value = .Range("E105").Value
End With
End Sub

Second Module:

'Pastes "January" in Month headers
With Sheets("Worksheet").Range("B4")
.Value = "January"
.Font.FontStyle = "Bold"
.Font.ColorIndex = 2
End With
With Sheets("Forecast Report").Range("B3").
.Value = "January"
.Font.FontStyle = "Bold"
.Font.ColorIndex = 2
End With
Sheets("Forecast Report").Range("B4:B6").Select
Call CopyPaste 'Call the CopyPaste Routine
End Sub

--
HTH...

Jim Thomlinson


"cheeser83" wrote:

First Module:

Public Sub CopyPaste()

'
Sheets("Forecast Report").Select 'Copies Total Yards from
currenct Forecast and pastes
Range("E105").Select 'to LST FRCST PRDCT
Total for the new Forecast Report
Selection.Copy
Range("AL105").PasteSpecial xlPasteValues




End Sub

Second Module:

Sheets("Worksheet").Select
'Pastes "January" in Month headers
Range("B4").Select
ActiveCell.FormulaR1C1 = "January"
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Sheets("Forecast Report").Select
Range("B3").Select
ActiveCell.FormulaR1C1 = "January"
With ActiveCell.Characters(Start:=1, Length:=7).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
End With
Range("B4:B6").Select
End Sub

I need to run one module and then the other. The order doesn't matter.
However, I will have 12 modules similar to module 2, one for each
month. I don't want to just paste the code from module 1 into two
because I will be adding to it later.
Jim Thomlinson wrote:
Post your code...
--
HTH...

Jim Thomlinson


"cheeser83" wrote:

I have to Macros. The first one will copy data from one sheet and
paste it to another. The second one will then change the data in
certain cells to the proper Month Name.

What I would like to do is have one macro for each month. After it
inputs the proper month name, it then runs the copy and paste macro.
Is there a way to do this???

Any help is MUCH appreciated!





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
Running VB macros gwtechie72 New Users to Excel 2 November 12th 07 10:04 PM
running macros from IF CJ Excel Worksheet Functions 2 April 30th 06 05:03 PM
HELP - Running Macros in VBA Louise New Users to Excel 7 April 6th 05 03:21 PM
Running Macros simpleS Setting up and Configuration of Excel 1 February 17th 05 02:32 PM
Macros not running StephanieH Excel Programming 2 December 14th 04 01:39 PM


All times are GMT +1. The time now is 09:22 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"