Thread: IF formula?
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default IF formula?

Worksheet functions will not move data from one sheet to another. You can
only reference other cells with worksheet functions

You need a macro to actually move the data. the macro below should do the job

Sub moveitems()

With ActiveSheet
OldRowCount = 1
NewRowCount = 1
Do While .Range("B" & OldRowCount) < ""
If IsDate(.Range("A" & OldRowCount)) Then
If (Date - .Range("B" & OldRowCount)) 60 And _
.Range("L" & OldRowCount) = "" Then

.Range("E" & OldRowCount & ":G" & OldRowCount).Copy
With Sheets("Sheet2")
.Range("A" & NewRowCount).Paste
NewRowCount = NewRowCount + 1
End With
End If
End If
OldRowCount = OldRowCount + 1
Loop
End With
End Sub

"Eucalypta" wrote:

Dear reader,
I kindly request your help with the following:
I want Excel to lookup multiple values i(col. E, F and G) in a row and copy
them to a separate worksheet if criteria are met.
Worksheet:
Col.B Col.E Col.F Col.G Col.H Col.L
Date Art. # # Pieces Price Total Order#
11-01-08 411-00-7 40.000 3,15 126.000
Criteria:
If the date in col. B is at least two months later and col. L is empty, I
want Excel to copy the contents of col. E-F-G to a separate worksheet.

I have tried lookup and if, but do not seem to be able to tell Excel what I
want. Can anyone help me, please? I am using Excel 2003.

Kind regards,
Eucalypta
--
A smile will carry you around the world