Dear members
I have following code it works fine but the problems in code If
c.Range("A" & itr) <> arr(11) And c.Range("C" & itr) <> arr(0) Then it
is fulfilling either one before And or after And I want it to fulfill
both the condition can any body help me out....
Sub PopulateOutstanding()
Dim itr As Long 'row on sheet itph
Dim rqr As Long 'row on sheet required
Dim osr As Long 'row on sheet outstanding
Dim arr(11) As String ' 11 element array to hold the required
Dim c As Worksheet
Dim i As Worksheet
Dim r As Worksheet
Set c = Worksheets("ITPH")
Set i = Worksheets("REQUIRED")
Set r = Worksheets("OUTSTANDING")
'clear required sheet
r.Range("A2:" & r.Range("L2").End(xlDown).Address).Clear
'set up start rows
rqr = 2
osr = 2
'step through required
Do While i.Range("A" & rqr) <> ""
arr(0) = i.Range("A" & rqr)
arr(1) = i.Range("B" & rqr)
arr(2) = i.Range("C" & rqr)
arr(3) = i.Range("D" & rqr)
arr(4) = i.Range("E" & rqr)
arr(5) = i.Range("F" & rqr)
arr(6) = i.Range("G" & rqr)
arr(7) = i.Range("H" & rqr)
arr(8) = i.Range("I" & rqr)
arr(9) = i.Range("J" & rqr)
arr(10) = i.Range("K" & rqr)
arr(11) = i.Range("L" & rqr)
'now loop through itph
itr = 2
Do While c.Range("A" & itr) <> ""
If c.Range("A" & itr) <> arr(11) And c.Range("C" & itr) <>
arr(0) Then
'arr(10) = c.Range("B" & itr)
'arr(11) = c.Range("C" & itr)
r.Range("A" & osr, "L" & osr) = arr
osr = osr + 1
End If
itr = itr + 1
Loop
rqr = rqr + 1
Loop
End Sub
Best Regards
Momin Siraj Ahmad
[Non-text portions of this message have been removed]
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar