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 fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,215,432
Messages
6,124,860
Members
449,194
Latest member
HellScout

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