Emily_SERT
New Member
- Joined
- Sep 17, 2009
- Messages
- 11
I have three macros that I'm attempting to combine to run as one in Excel 2007 (1-copy and paste cells to several worksheets, 2-sort several worksheets simultaneously, 3-sort the summary worksheet). Per other posts I created a "main" macro and "call"ed the other macros in. The main macro runs through, but the copy and paste macro does not seem to actually work within the combined macro (all work seperately).
This is the code I used:
When that didn't work, I also tried using the full code from each of the macros:
I would appreciate any help you can provide.
This is the code I used:
Code:
Sub main()
Call Fill_Names
Call DynaSort_Assign
Call Sort_TimeSummary
End Sub
When that didn't work, I also tried using the full code from each of the macros:
Code:
Sub main()
Call Fill_Names
Sheets("Time Summary").Select
Range("A8:B308").Select
Selection.Copy
Sheets("Time-Week 1").Select
Range("A8").Select
ActiveSheet.Paste
Sheets("Time-Week 2").Select
Range("A8").Select
ActiveSheet.Paste
Sheets("Time-Week 3").Select
Range("A8").Select
ActiveSheet.Paste
Sheets("Time-Week 4").Select
Range("A8").Select
ActiveSheet.Paste
Sheets("Time-Week 5").Select
Range("A8").Select
ActiveSheet.Paste
Sheets("Time-Week 6").Select
Range("A8").Select
ActiveSheet.Paste
Sheets("Time Summary").Select
Range("A8").Select
Call DynaSort_Assign
Dim wsSheet As Worksheet
Dim v As Range
Dim findRow As Integer
Dim c As Range
For Each wsSheet In Worksheets
Select Case wsSheet.CodeName
Case "Sheet9", "Sheet17", "Sheet18", "Sheet19", "Sheet20", "Sheet21"
Set FindRng = wsSheet.Range("A8:AD8" & wsSheet.Range("A65536").End(xlUp).Row)
With FindRng
Set c = .Find(What:="", After:=FindRng.Cells(1, 1), LookIn:=xlValues, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not c Is Nothing Then
findRow = c.Row - 1
Else
findRow = FindRng.Rows.Count + 7
End If
End With
With wsSheet.Range("A8:AD8" & findRow)
.Sort Key1:=.Range("A8"), Order1:=xlAscending, _
Key2:=.Range("B8"), Order2:=xlAscending, Header:=xlNo
End With
Case Else
'Nothing
End Select
Next wsSheet
Call Sort_TimeSummary
Range("A8:B308").Select
ActiveWorkbook.Worksheets("Time Summary").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Time Summary").Sort.SortFields.Add Key:=Range("A8" _
), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Time Summary").Sort
.SetRange Range("A8:B308")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
I would appreciate any help you can provide.
Last edited: