ctouchberry
New Member
- Joined
- Dec 4, 2017
- Messages
- 40
I got the function to work on a previous section of code, and then adapted it for use in this new section. I'm not sure what the issue is.
I want the code to look at the value in JCX/14, and it to the value in 08-Attribute/1. If they match, then put the value in 08-Attribute/9 in JCX/14, in the correct row. If there are multiple values in 08-Attribute/9 with the same value in Column 1, then the Column 9 values need to be put in successive columns in that same row.
https://imgur.com/a/imwMx
https://imgur.com/a/tDT8X
Code:
TagRowCounter = 2
Do
Sheets("JCX").Cells(TagRowCounter, 14).Value = Application.VLookup(Sheets("JCX").Cells(TagRowCounter, 10), Sheets("08-Attribute").Range("A"), 9, 0)
If Sheets("08-Attribute").Cells(AttributeRowCounter, 9) = "CFM" Then
Sheets("JCX").Cells(TagNumberRow, 14).Value = Sheets("08-Attribute").Cells(AttributeRowCounter, 11).Value
ElseIf Sheets("08-Attribute").Cells("AttributeRowCounter,9") = "SP" Then
Sheets("JCX").Cells(TagNumberRow, 15).Value = Sheets("08-Attribute").Cells(AttributeRowCounter, 11).Value
ElseIf Sheets("08-Attribute").Cells("AttributeRowCounter,9") = "RPM" Then
Sheets("JCX").Cells(TagNumberRow, 16).Value = Sheets("08-Attribute").Cells(AttributeRowCounter, 11).Value
ElseIf Sheets("08-Attribute").Cells("AttributeRowCounter,9") = "Motor_HP" Then
Sheets("JCX").Cells(TagNumberRow, 17).Value = Sheets("08-Attribute").Cells(AttributeRowCounter, 11).Value
Else
'Tag Value Name
Sheets("JCX").Cells(TagNumberRow, 20).Value = Sheets("08-Attribute").Cells(AttributeRowCounter, 9).Value
TagValueNameColumn = TagValueNameColumn + 2
'Tag Value Number
Sheets("JCX").Cells(TagNumberRow, 21).Value = Sheets("08-Attribute").Cells(AttributeRowCounter, 11).Value
TagValueColumn = TagValueColumn + 2
TagRowCounter = TagRowCounter + 1
AttributeRowCounter = AttributeRowCounter + 1
End If
Last edited: