Loop or Find code ?? need help !!

E

EBnLP01

............A...........B.............C...........D
1.........EB.........TF...........JAH........45
2.........RG........TF............JAH.......78
3.........EB..........BE............NC.......99

Description :
Column "A" = Draftsman
Column "B" = Checker
Column "C" = Group
Column "D" = Cost per Job
(each row is a different job)
This is on worksheet "List Input"

This (below) is on worksheet "Sheet2"
End user will be able to pick which draftsman he wants to look at and all
his cost

What i need help with :
Trying to write code to look at who the end user wants to look at, and
display all the jobs that he's worked on.

Example :
End user picked "EB"
On the "List Input" page, the code will look down column "A". Everytime it
sees "EB", it copies the entire row, and places it in a specific range of
cells on "Sheet2". Once it has checked all in column "A", it stops.

Can anyone help me please ?
Thanks,
Eric
 
B

Bernard Liengme

It appears you want to do this with VBA
But why not just just a Filter?
best wishes
 
M

Max

You could try this easy formulas powered model
(set it up in a minute, works forever)

In Sheet2,
Input will be in A1, eg: EB

In B1: =IF($A$1="","",IF('List Input'!A1=$A$1,ROW(),""))
In C1:
=IF(ROWS($1:1)>COUNT($B:$B),"",INDEX('List
Input'!A:A,SMALL($B:$B,ROWS($1:1))))
Copy C1 across to F1. Select B1:F1, copy down to cover the max expected
extent of source data in 'List Input'. Minimize/hide col B. You'd get the
required results dependent on the input in A1, with all lines neatly stashed
at the top. Success? hit the YES below
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:27,000 Files:200 Subscribers:70
xdemechanik
 
B

Bernard Liengme

I put you data as shown below on Sheet1
1.........Drafter...Checker...Group....Cost
2.........EB.........TF...........JAH........45
3.........RG........TF............JAH.......78
4.........EB..........BE............NC.......99

On Sheet2 in A4 I entered the drafter required (e.g. EB)
Then I used this code to extract he data on Sheet2.

Sub getdrafter()
mytest = Worksheets("Sheet2").Range("A4")
myLast = Worksheets("Sheet1").Cells(Cells.Rows.Count, "A").End(xlUp).Row
j = 5
For k = 2 To myLast
If Worksheets("Sheet1").Cells(k, 1) = mytest Then
For cols = 1 To 4
Worksheets("Sheet2").Cells(j, cols) = Worksheets("Sheet1").Cells(k,
cols)
Next cols
j = j + 1
End If
Next k
End Sub

best wishes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top