PDA

View Full Version : multiple workbooks--take values and match



kwik10z
11-29-2007, 07:56 AM
I have this code that matches values within workbooks, but i am going to list what i need done. cuz im not sure if the code completely fulfills what i need.

Sub Reference_Designator()
' wsheet1 and wsheet2 both point to the worksheets where you are looking for info.
' row 1 tracks what row you are on in the first worksheet
' row2 treack what row you are on in the second
' crit1 tracks what your looking for in the first worksheet
' crit2 tracks what you are looking for in the second.
Dim wsheet1 As Worksheet, wsheet2 As Worksheet
Dim row1 As Long, row2 As Long
Dim crit1 As String, crit2 As String
row1 = 9
Set wsheet1 = Workbooks("Testfile2.xls").Worksheets("Sheet1")
Set wsheet2 = Workbooks("2x2component.xls").Worksheets("2x2component")
crit1 = 25
While wsheet1.Range("B" & row1) <> ""
If wsheet1.Range("A" & row1) = crit1 Then
row2 = 3
crit2 = wsheet1.Range("F" & row1)
While wsheet2.Range("B" & row2) <> ""
If wsheet2.Range("B" & row2) = crit2 Then
'last step
End If
row2 = row2 + 1
Wend
End If
row1 = row1 + 1
Wend
End Sub

All attachments will be posted below in following posts. (since i can only attach one per post, i will make seperate posts with attachments)

What i need:
1. In Attachment 1 - trigger value of "25".
2. In Attachment 1 - Scan every row in column A for the trigger value. Once a trigger value is found, look in column F at the "reference designator" (should be a letter/number --for example: J1 or U14)
3. Take that value(reference designator) match it with column A of attachment 2.
4. When it matches the values of the two worksheets, define column E(attachment 2) as "Component Rotation Angle" and column F(attachment 2) as "Comp_XY" (X and Y coordinates of component).

Thanks:bow:you guys are life savers

kwik10z
11-29-2007, 07:58 AM
attachment has been moved to next post inside zipped folder!

kwik10z
11-29-2007, 07:58 AM
Here are both attachments

7413

thanks for the tip on attaching the files!

kwik10z
11-29-2007, 01:12 PM
please, anyone?

lucas
11-29-2007, 02:28 PM
I am able to follow the process up to step 4 and I lose your intent there. Can you clarify what you want to happen?

ps if you have Windows XP you can right click on multiple selected files and then go to send to---select "compressed zipped folder" and it will zip them up for you.....

kwik10z
11-30-2007, 05:19 AM
I am able to follow the process up to step 4 and I lose your intent there. Can you clarify what you want to happen?

ps if you have Windows XP you can right click on multiple selected files and then go to send to---select "compressed zipped folder" and it will zip them up for you.....

ya sure!

step 4. If you open the second workbook, you will see there are column titles like this:

Column A........Column B........Column E.........Column F........Column G
Ref Des.......... Enabled........Comp Rotation........X..................Y
J1..........................................270...............450.......... ....1625

the rows of Column F in attachment 1 and the rows of Column A in attachment 2 should match....when the code finds a match (J1) have the code look at column E, F, and G like shown above and define values so i can plug them into formulas and statements later on.

For example, Define the value of said row in column E(comp rotation) "component rotation angle", Column F (X coordinate) "Comp_X" and Column G (Y coordinate) "Comp_Y". But i guess what i dont know how to ask, is..i need to be able to define them in regards to what the "ref des" is.

Like J1, rotate the chip 270degrees, and the xy coordinates are the center of the chip--which then has to look at a third attachment and use coordinates and the insertion origin to place it at the correct place on the circuit board.

Here is the machine i have to work with. pick and place machine (http://www.apsgold.com/l-series.html)

Sorry for the confusion, i know im asking for alot, and if you cant help, thats fine....thanks for the try.