Hey guys, having a problem here.
Below is the code that I've written, and mostly it works... just one minor (ok, major) point that isn't.
This is connected to a User form with inputs PartNo, Count, and UOM. What I want is for the user to be able to enter the three values and have it search down the list to see if there is a matching value. If there is, I want it to add the counts together. If there isn't, I want it to search for the next blank and write the values in. If the partno already exists it's working fine, it's the blank that I can't figure out. My loop isn't working properly and I keep getting interrupted by a screaming boss so I can't even tell if my logic is right. Please help! Thank you. Kristen
Below is the code that I've written, and mostly it works... just one minor (ok, major) point that isn't.
This is connected to a User form with inputs PartNo, Count, and UOM. What I want is for the user to be able to enter the three values and have it search down the list to see if there is a matching value. If there is, I want it to add the counts together. If there isn't, I want it to search for the next blank and write the values in. If the partno already exists it's working fine, it's the blank that I can't figure out. My loop isn't working properly and I keep getting interrupted by a screaming boss so I can't even tell if my logic is right. Please help! Thank you. Kristen
Code:
ActiveWorkbook.Sheets("Data").Activate
Range("A2").Select
If ActiveCell = "" Then
ActiveCell.Value = PartNo.Value
ActiveCell.Offset(0, 3) = Price.Value
ActiveCell.Offset(0, 2) = Count.Value
ActiveCell.Offset(0, 1) = UOM.Value
Else:
Do
If ActiveCell = PartNo.Value Then
ActiveCell.Offset(0, 3) = Price.Value
ActiveCell.Offset(0, 2) = ActiveCell.Offset(0, 2) + Count.Value
ActiveCell.Offset(0, 1) = UOM.Value
Else
ActiveCell.Offset(1, 0).Select
Loop Until IsEmpty(ActiveCell) = True
End If
End If