From: Kash on 12 May 2010 06:55 I have 4 conditions 1) If Sheets("Details").Range("H" & lngRow) > Date - 90 And _ 2) Sheets("Details").Range("F" & lngRow) = Sheets("Search").Range("C2") And _ 3) Sheets("Details").Range("J" & lngRow) = Sheets("Search").Range("C4") And _ 4) Sheets("Details").Range("I" & lngRow) = Sheets("Search").Range("E4") Then if Sheets("Search").Range("E2") is blank then condition 1 should be skipped if Sheets("Search").Range("C2") is blank then condition 2 should be skipped if Sheets("Search").Range("C4") is blank then condition 3 should be skipped if Sheets("Search").Range("E4") is blank then condition 4 should be skipped Please help me with this.. -------------------------------------- Sub GetAll() Dim lngRow As Long Dim lngLastRow As Long Dim lngNewRow As Long Dim varTemp As Variant Sheets("Search").Select Range("A9:L65536").Select Selection.ClearContents Application.Goto Reference:="R9C1" Application.ScreenUpdating = False lngLastRow = Sheets("Details").Cells(Rows.Count, "B").End(xlUp).Row lngNewRow = Sheets("Search").Cells(Rows.Count, "A").End(xlUp).Row + 1 For lngRow = 1 To lngLastRow If Sheets("Details").Range("H" & lngRow) > Date - 90 And _ Sheets("Details").Range("F" & lngRow) = Sheets("Search").Range("C2") And _ Sheets("Details").Range("J" & lngRow) = Sheets("Search").Range("C4") And _ Sheets("Details").Range("I" & lngRow) = Sheets("Search").Range("E4") Then varTemp = Sheets("Details").Range(lngRow & ":" & lngRow) Sheets(4).Range(lngNewRow & ":" & lngNewRow) = varTemp lngNewRow = lngNewRow + 1 End If Next
|
Pages: 1 Prev: Macro to delete entire row Next: Alphabetize Macros in a module |