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
|