Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
This look works fine. However, I want to make a similar loop to look at each
row and delete certain cells where the variable ClosCheck is True. The cells are not necessarily adjacent: a:f, k:m and o:s. How do you handle multiple criteria. I could use offsets from ClosCHeck, that would clear the contents of the designated cells, but I wondered if there was a better way. -Andy Sub MoveCompletedTradesLoop() Dim TradesEntered As Range, ClosCheck As Range With Sheets("Analysis") Set TradesEntered = .Range("at17:at56") End With 'Loop: Check for complete trades, copy to Trade History For X = 1 To TradesEntered.Count Set ClosCheck = TradesEntered(X) If ClosCheck.Value = "True" Then With ClosCheck .Worksheet.Select ClosCheck.EntireRow.Select Selection.Copy Sheets("TradeHistory").Select Range("A4").Activate Selection.End(xlDown).Select ActiveCell.Offset(rowoffset:=1, columnoffset:=0).Activate ActiveCell.EntireRow.Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = False Range("A1").Select Sheets("Analysis").Select Range("A1").Select End With 'Else ' MsgBox ("OK") 'Goes with Else. Comment out ' Exit Sub 'Goes with Else. Comment it out. End If Next 'Ends "For Each" Loop End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding based on Multiple Criteria? | Excel Discussion (Misc queries) | |||
Adding a loop to conditional delete code | New Users to Excel | |||
adding value only if criteria is true | Excel Worksheet Functions | |||
Adding in loop | Charts and Charting in Excel | |||
adding up several different criteria | Excel Worksheet Functions |