untested:
VBA Code:
--------------------
Application.ScreenUpdating = False
lngLastRow = Sheets("Details").Cells(Rows.Count, "B").End(xlUp).Row
lngNewRow = Sheets("Search").Cells(Rows.Count, "A").End(xlUp).Row + 1
With Sheets("Search")
Select Case UCase(.Range("C4"))
Case "SEC": TheCol = "M"
Case "FIRST", "": TheCol = "J"
Case Else 'the default/error option
'TheCol = "J"
MsgBox "Check cell C4 on the Search sheet"
Exit Sub
End Select
For lngRow = 1 To lngLastRow
If (Sheets("Details").Range("H" & lngRow) Date - 90 Or Len(.Range("E2").Value) = 0) And _
(Sheets("Details").Range("F" & lngRow) = .Range("C2") Or Len(.Range("C2").Value) = 0) And _
(Sheets("Details").Range(TheCol & lngRow) = .Range("C4") Or Len(.Range("C4").Value) = 0) And _
(Sheets("Details").Range("I" & lngRow) = .Range("E4") Or Len(.Range("E4").Value) = 0) Then
varTemp = Sheets("Details").Range(lngRow & ":" & lngRow)
Sheets(4).Range(lngNewRow & ":" & lngNewRow) = varTemp
lngNewRow = lngNewRow + 1
End If
Next
End With
--------------------
Kash;722155 Wrote:
Thank you Pascal.. :)
is it also possible that we can change the lookup column according to
the
value of the cell?
for eg., in the below statement
if the value of Range("C4") = "First" it should lookup in Range("J" &
lngRow)
if the value of Range("C4") = "Sec" it should lookup in Range("M" &
lngRow)
------------------------------------------
(Sheets("WFM Details").Range("J" & lngRow) = .Range("C4") Or
Len(.Range("C4").Value) = 0) And _
--
p45cal
*p45cal*
------------------------------------------------------------------------
p45cal's Profile:
http://www.thecodecage.com/forumz/member.php?u=558
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=202176
http://www.thecodecage.com/forumz