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
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