Compile Error Expected: Then or GoTo

Rowboc

New Member
Joined
Jan 14, 2025
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi, my first time at this and got stuck and not sure what's missing or what the issue is. Please could you assist

'Validating Supplier

If Trim(frm.Range("G8").Value) <> "Abtech Ltd" And Trim(frm.Range("G8").Value) <> "AC Valves Controls Ltd" _
And Trim(frm.Range("G8").Value) <> "Access Electrical Services Ltd" And Trim(frm.Range("G8").Value) <> "Alken Systems" _
And Trim(frm.Range("G8").Value) <> "Allied Protek Engineering Solutions Ltd " And Trim(frm.Range("G8").Value) <> "Alma Sheet Metal Ltd" _
And Trim(frm.Range("G8").Value) <> "Andy Castle Engineering" And Trim(frm.Range("G8").Value) <> "Aquaseal Rubber Ltd" _
And Trim(frm.Range("G8").Value) <> "Auma Actuators Ltd" And Trim(frm.Range("G8").Value) <> "Avian Pr Tech" _
And Trim(frm.Range("G8").Value) <> "Axis Hydraulics" And Trim(frm.Range("G8").Value) <> "Camozzi Automation Ltd" _
And Trim(frm.Range("G8").Value) <> "Carrs Welding Technologies Ltd" And Trim(frm.Range("G8").Value) <> "Castell Safety International Ltd" _
And Trim(frm.Range("G8").Value) <> "CEMB Hofmann UK Limited" And Trim(frm.Range("G8").Value) <> "Chicago Coating Company Ltd" _
And Trim(frm.Range("G8").Value) <> "E Bennett Electrical Co." And Trim(frm.Range("G8").Value) <> "Emmett Enterprises" _
And Trim(frm.Range("G8").Value) <> "Eriks Sealing Technology And Trim(frm.Range("G8").Value) <> "Essentra Components" _
And Trim(frm.Range("G8").Value) <> "Extruded Plastics Ltd" And Trim(frm.Range("G8").Value) <> "TM Plastics" _
And Trim(frm.Range("G8").Value) <> "Four D Rubber Co" And Trim(frm.Range("G8").Value) <> "Fike Europe B.v.b.a" _
And Trim(frm.Range("G8").Value) <> "Greenwood Magnetics Ltd" And Trim(frm.Range("G8").Value) <> "H Crabtree Ltd" _
And Trim(frm.Range("G8").Value) <> "Heywood and Palmer Eng" And Trim(frm.Range("G8").Value) <> "Pepperl and Fuchs GB Ltd" _
And Trim(frm.Range("G8").Value) <> "Progress Engineering Ltd" And Trim(frm.Range("G8").Value) <> " RS Components Ltd" _
And Trim(frm.Range("G8").Value) <> "Salamander Fabrications Ltd" And Trim(frm.Range("G8").Value) <> "Scattergood and Johnson" _
And Trim(frm.Range("G8").Value) <> "Silicone Engineering Limited" And Trim(frm.Range("G8").Value) <> "Skaigh Engineering Ltd" _
And Trim(frm.Range("G8").Value) <> "SKF UK Ltd" And Trim(frm.Range("G8").Value) <> "Talbot Engineering Ltd" _
And Trim(frm.Range("G8").Value) <> "Taylormade Castings Ltd" And Trim(frm.Range("G8").Value) <> "Terrill Bros Founders Ltd" _
And Trim(frm.Range("G8").Value) <> "Valvengineering SRL" Then
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Welcome to the forum. :)

You are missing a closing quote on the end of "Eriks Sealing Technology
 
Upvote 0
Hi
welcome to forum

Just a suggestion - rather than hard code all those values consider placing them in a table which would be easier to maintain & simplify your code a little

VBA Code:
   Dim Supplier    As Variant
    Dim loSupplier  As ListObject
    
    Set loSupplier = ThisWorkbook.Worksheets("Sheet1").ListObjects(1)
    
    Supplier = loSupplier.DataBodyRange.Value
    
    If IsError(Application.Match(Trim(frm.Range("G8").Value), Supplier, 0)) Then
        
        'no match

        
    Else
        
        'match
        
    End If

Dave

14-01-2025.xls
A
1Suppliers
2Abtech Ltd
3AC Valves Controls Ltd
4Access Electrical Services Ltd
5Alken Systems
6Allied Protek Engineering Solutions Ltd
7Alma Sheet Metal Ltd
8Andy Castle Engineering
9Aquaseal Rubber Ltd
10Auma Actuators Ltd
11Avian Pr Tech
12Axis Hydraulics
13Camozzi Automation Ltd
14Carrs Welding Technologies Ltd
15Castell Safety International Ltd
16CEMB Hofmann UK Limited
17Chicago Coating Company Ltd
18E Bennett Electrical Co.
19Emmett Enterprises
20Eriks Sealing Technology
21Essentra Components
22Extruded Plastics Ltd
23TM Plastics
24Four D Rubber Co
25Fike Europe B.v.b.a
26Greenwood Magnetics Ltd
27H Crabtree Ltd
28Heywood and Palmer Eng
29Pepperl and Fuchs GB Ltd
30Progress Engineering Ltd
31RS Components Ltd
32Salamander Fabrications Ltd
33Scattergood and Johnson
34Silicone Engineering Limited
35Skaigh Engineering Ltd
36SKF UK Ltd
37Talbot Engineering Ltd
38Taylormade Castings Ltd
39Terrill Bros Founders Ltd
40Valvengineering SRL
Sheet1
 
Upvote 0

Forum statistics

Threads
1,226,107
Messages
6,188,968
Members
453,515
Latest member
maccannix

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