
Originally Posted by
JBeaucaire
Can you post up your macro (don't forget to put code tags around the code) and point out IN the macro where you would want this evaluation to occur? There are many ways to do this and how you're working through your sheet will affect the answer(s).
Sub SPGBreaksheet()
'
' SPGBreaksheet Macro
'
'
Sheets.Add After:=Sheets(Sheets.Count)
Sheets.Add After:=Sheets(Sheets.Count)
Sheets.Add After:=Sheets(Sheets.Count)
Sheets.Add After:=Sheets(Sheets.Count)
Sheets.Add After:=Sheets(Sheets.Count)
Sheets.Add After:=Sheets(Sheets.Count)
Sheets("TRECS").Select
Sheets("TRECS").Move After:=Sheets(7)
ActiveWindow.Zoom = 85
Range("I:I,L:L,M:M,N:N").Select
Range("N1").Activate
Selection.Delete Shift:=xlToLeft
Range("F:H,K:K").Select
Range("K1").Activate
Selection.NumberFormat = "_(* #,##0.00_);_(* (#,##0.00);_(* ""-""??_);_(@_)"
Cells.Select
Selection.Copy
Sheets("Sheet1").Select
ActiveSheet.Paste
ActiveWindow.Zoom = 85
Range("A1:K173").Select
Range("D1").Activate
Application.CutCopyMode = False
Selection.AutoFilter
Selection.Columns.AutoFit
Sheets("Sheet1").Name = "Position"
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
ActiveSheet.Next.Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.Copy
Application.CutCopyMode = False
Selection.AutoFilter
Selection.Columns.AutoFit
ActiveWindow.Zoom = 85
Selection.Copy
ActiveSheet.Next.Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.AutoFilter
Selection.Columns.AutoFit
ActiveWindow.Zoom = 85
Sheets("Sheet3").Name = "AS"
Selection.Copy
ActiveSheet.Next.Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.AutoFilter
Selection.Columns.AutoFit
ActiveWindow.Zoom = 85
Sheets("Sheet4").Name = "Yesterday"
Columns("A:A").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveSheet.Next.Select
ActiveSheet.Previous.Select
Range("C1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
ActiveSheet.Next.Select
ActiveSheet.Paste
ActiveWindow.Zoom = 85
Application.CutCopyMode = False
Selection.AutoFilter
Selection.Columns.AutoFit
Sheets("Sheet5").Name = "CCY"
Selection.Copy
ActiveSheet.Next.Select
ActiveSheet.Paste
ActiveWindow.Zoom = 85
Application.CutCopyMode = False
Selection.AutoFilter
Selection.Columns.AutoFit
Sheets("Sheet6").Name = "Futures"
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
ActiveSheet.Previous.Select
Sheets("Sheet2").Name = "CA"
ActiveSheet.Previous.Select
ActiveWorkbook.Worksheets("Position").AutoFilter.Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Position").AutoFilter.Sort.SortFields.Add Key:= _
Range("E1:E173"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption _
:=xlSortNormal
With ActiveWorkbook.Worksheets("Position").AutoFilter.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Dim Data, del As Range
Dim Cll As Excel.Range
Dim m As Long
Dim n As Long
Range(Cells(1, 5), Cells(Rows.Count, 5).End(xlUp)).Select
Set Data = Excel.Selection
For Each Cll In Data.Cells
If Left(Cll.Value, 3) = "995" Then
Cll.EntireRow.Cut
ActiveSheet.Paste Sheets("CCY").Range("A65536").End(xlUp).Offset(1, 0)
End If
Next Cll
Range(Cells(1, 5), Cells(Rows.Count, 5).End(xlUp)).Select
Set Data = Excel.Selection
For Each Cll In Data.Cells
If Left(Cll.Value, 3) = "9FF" Then
Cll.EntireRow.Cut
ActiveSheet.Paste Sheets("Futures").Range("A65536").End(xlUp).Offset(1, 0)
End If
Next Cll
End Sub
I want it to come right before end sub or in other words I want it to be the last thing to happen. Also in that same section, I am wondering if it finds CRL in column C it will Italicize the entire row independent of its value. Then if it locates in column K anything less than 25,000 if it will highlight the entire row green. Lastly I want it to search column c and k and if it finds crl and less than 100,000 respectively for the entire row to be highlighted green.
Bookmarks