Help with Loop Without Do Error

Coltaine

New Member
Joined
Jan 25, 2017
Messages
2
Hi guys,

I've been trying to fix this VBA code (that a previous employee left us), but since I have no experience in VBA, I can't seem to figure it out. Would anyone of y'all be able to help me out?

Code:
Sub categorization3a()
 
Application.ScreenUpdating = False
 
'further segment [B]PRODUCT[/B]
 
row = 2
 
Do While Cells(row, 1) <> ""
 
For row = 3 To 800
    If Cells(row, 10) = “[B]PARENT PRODUCT[/B]" Then
        If InStr(1, Cells(row, 7), "[B]SUBPRODUCTCODE1A[/B]") Or InStr(1, Cells(row, 7), "") Or InStr(1, Cells(row, 7), "[B]SUBPRODUCTCODE1B[/B]") Or InStr(1, Cells(row, 7), "[B]SUBPRODUCTCODE1C[/B]") Then
            Cells(row, 10) = "[B]SUBPRODUCT1[/B]"
        ElseIf InStr(1, Cells(row, 7), "[B] SUBPRODUCTCODE2A[/B]") Or InStr(1, Cells(row, 7), "[B] SUBPRODUCTCODE2B[/B]") Or InStr(1, Cells(row, 7), "[B] SUBPRODUCTCODE2C[/B]") Or InStr(1, Cells(row, 7), "[B] SUBPRODUCTCODE2D[/B]") Or InStr(1, Cells(row, 7), "[B] SUBPRODUCTCODE2E[/B]") Or InStr(1, Cells(row, 7), "[B] SUBPRODUCTCODE2F[/B]") Then
            Cells(row, 10) = "[B] SUBPRODUCT2[/B]"
        ElseIf InStr(1, Cells(row, 7), "[B] SUBPRODUCTCODE3A[/B]") Or InStr(1, Cells(row, 7), "[B] SUBPRODUCTCODE3B[/B]") Or InStr(1, Cells(row, 7), "[B] SUBPRODUCTCODE3C[/B]") Then
            Cells(row, 10) = "[B] SUBPRODUCT3[/B]"
        ElseIf InStr(1, Cells(row, 7), "[B] SUBPRODUCTCODE4A[/B]") Then
            Cells(row, 10) = "[B] SUBPRODUCT4[/B]"
        Else
            Cells(row, 10) = "[B]PARENT PRODUCT[/B]"
        End If
    End If
 
    row = row + 1
   
Loop
 
           
Application.ScreenUpdating = True
 
 
 
End Sub


Thanks!!! I appreciate it a lot
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,214,905
Messages
6,122,174
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top