Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Increment output

Status
Not open for further replies.

wafs

Technical User
Jan 17, 2006
112
US
Here is a report that I need to run. I can get the first part number to run, but now I need to increment myrange and rsearch. I need it to keep the same part number and ID number on the same row and when the part number changes, it is placed on a new row. Any suggestions.

Part Number ID Number WSH TP ROLL HT Ship
11588715 1428 X X



'Output into destination sheet
p = p + 1
m = p + 1
Do
Set myrange = Sheets(sh).Range(TestRange3)
Set rsearch = Sheets(destsh).Range(output(13))
If myrange = rsearch Then

vRet = Application.WorksheetFunction.VLookup(myrange, Worksheets("data").Range("A2:G300"), 2, False)
reportlocation = "A" + m 'partnumber
Sheets(destsh).Range(reportlocation) = vRet
If UCase(Trim(Sheets(sh).Range(TestRange))) = UCase(Trim(Sheets(destsh).Range(output(13)))) Then 'WSH
reportlocation = "C" + m 'X WSH
Sheets(destsh).Range(reportlocation) = strvar1
ElseIf UCase(Trim(Sheets(sh).Range(TestRange))) = UCase(Trim(Sheets(destsh).Range(output(5)))) Then 'ROLL
reportlocation = "E" + m 'X ROLL
Sheets(destsh).Range(reportlocation) = strvar1
ElseIf UCase(Trim(Sheets(sh).Range(TestRange))) = UCase(Trim(Sheets(destsh).Range(output(9)))) Then 't/p
reportlocation = "D" + m 'X TP
Sheets(destsh).Range(reportlocation) = strvar1
ElseIf UCase(Trim(Sheets(sh).Range(TestRange))) = UCase(Trim(Sheets(destsh).Range(output(7)))) Then 'HT
reportlocation = "F" + m 'X HT
Sheets(destsh).Range(reportlocation) = strvar1
ElseIf UCase(Trim(Sheets(sh).Range(TestRange))) = UCase(Trim(Sheets(destsh).Range(output(11)))) Then 'Ship
reportlocation = "G" + m 'X SHIP
Sheets(destsh).Range(reportlocation) = strvar1
End If
End If
n = n + 1
TestRange3 = "A" + n
TestRange = "E" + n
output(1) = "A" + n
output(13) = "B" + n
Loop Until Sheets(destsh).Range(output(13)) =
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top