Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JOUIOUI
 
Posts: n/a
Default Basic Question on Subs

This is the most basic question I'm sure but how can I link numerous sub
statements into one macro?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Toppers
 
Posts: n/a
Default Basic Question on Subs

Sub MyMacros()

Call macro1
Call macro2
etc

End Sub

"Call" can be omitted from the above statements except if parameters are
passed to the routine.


HTH



"JOUIOUI" wrote:

This is the most basic question I'm sure but how can I link numerous sub
statements into one macro?

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default Basic Question on Subs

Like this???

Sub MainProgramNameHere()
call Prog1
call Prog2
'do some stuff locally??
call prog3
end sub



JOUIOUI wrote:

This is the most basic question I'm sure but how can I link numerous sub
statements into one macro?


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
SITCFanTN
 
Posts: n/a
Default Basic Question on Subs

Hi Dave,

Thanks for your help. I was hoping you could help me with this. My Sheet 1
is "All Records", I"m adding 6 new sheets which works great, but then the Add
REcords is not working. I'm trying to copy any rows with "4-$" in column A
and "GESA CC" in column B from the "All Records" Sheet to the "GESA CC"
Sheet. ANy ideas?

Sub AllRecordsSortMacros()

Call AddSheets
Call AddRecords


End Sub
Sub AddSheets()

Dim NewSheets As Variant
Dim i As Long

NewSheets = Array("Confirm", "GESV CC", "GESA CC", "GESA CK", "All
Matches", "All Non Matches")
For i = UBound(NewSheets) To LBound(NewSheets) Step -1
Sheets.Add after:=Sheets(1)
ActiveSheet.Name = NewSheets(i)
Next i

End Sub

Sub CopyData()
Dim rng As Range, cell As Range
Dim i As Long, sh As Worksheet
With Worksheets("All Matches")
Set rng = .Range(.Cells(1, 1), _
.Cells(Rows.Count, 1).End(xlUp))
End With
i = 1
Set sh = Worksheets("GESA CC")
For Each cell In rng
If UCase(Trim(cell.Value)) = "4-$" And _
UCase(Trim(cell.Offset(0, 1).Value)) = "Gesa CC" Then
cell.EntireRow.Copy sh.Cells(i, 1)
i = i + 1
End If
Next
End Sub

"Dave Peterson" wrote:

Like this???

Sub MainProgramNameHere()
call Prog1
call Prog2
'do some stuff locally??
call prog3
end sub



JOUIOUI wrote:

This is the most basic question I'm sure but how can I link numerous sub
statements into one macro?


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default Basic Question on Subs

Without too much looking...

If UCase(Trim(cell.Offset(0, 1).Value)) = "Gesa CC" Then

You're comparing something that upper case (you used uCase()) with "Gesa CC".
Well, there aren't any uppercase letters that match "esa", so there will never
be a match.

You could use:
If UCase(Trim(cell.Offset(0, 1).Value)) = "GESA CC" Then
or if you're really lazy:
If UCase(Trim(cell.Offset(0, 1).Value)) = ucase("Gesa CC") Then



SITCFanTN wrote:

Hi Dave,

Thanks for your help. I was hoping you could help me with this. My Sheet 1
is "All Records", I"m adding 6 new sheets which works great, but then the Add
REcords is not working. I'm trying to copy any rows with "4-$" in column A
and "GESA CC" in column B from the "All Records" Sheet to the "GESA CC"
Sheet. ANy ideas?

Sub AllRecordsSortMacros()

Call AddSheets
Call AddRecords

End Sub
Sub AddSheets()

Dim NewSheets As Variant
Dim i As Long

NewSheets = Array("Confirm", "GESV CC", "GESA CC", "GESA CK", "All
Matches", "All Non Matches")
For i = UBound(NewSheets) To LBound(NewSheets) Step -1
Sheets.Add after:=Sheets(1)
ActiveSheet.Name = NewSheets(i)
Next i

End Sub

Sub CopyData()
Dim rng As Range, cell As Range
Dim i As Long, sh As Worksheet
With Worksheets("All Matches")
Set rng = .Range(.Cells(1, 1), _
.Cells(Rows.Count, 1).End(xlUp))
End With
i = 1
Set sh = Worksheets("GESA CC")
For Each cell In rng
If UCase(Trim(cell.Value)) = "4-$" And _
UCase(Trim(cell.Offset(0, 1).Value)) = "Gesa CC" Then
cell.EntireRow.Copy sh.Cells(i, 1)
i = i + 1
End If
Next
End Sub

"Dave Peterson" wrote:

Like this???

Sub MainProgramNameHere()
call Prog1
call Prog2
'do some stuff locally??
call prog3
end sub



JOUIOUI wrote:

This is the most basic question I'm sure but how can I link numerous sub
statements into one macro?


--

Dave Peterson


--

Dave Peterson
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 this the proper place to ask my question? amkazen Excel Discussion (Misc queries) 1 March 1st 06 05:20 PM
Simple for you, tough for me, basic excel question cup0spam Excel Discussion (Misc queries) 1 May 31st 05 06:10 AM
Hints And Tips For New Posters In The Excel Newsgroups Gary Brown Excel Worksheet Functions 0 April 15th 05 05:47 PM
Basic Template Question CBH Excel Discussion (Misc queries) 3 April 4th 05 09:05 PM
basic pie chart question KayR Charts and Charting in Excel 4 January 23rd 05 08:16 PM


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