I am new to vba and my first time working with "Select Case". Briefly, I am trying to loop (number of rows will change from sheet to sheet) by finding the "cust_num" column header and go through each row, if the cust_num matches criteria on a particular row then "Barco" will be put into the same row under the "company name" column.
When I compile "Barco" is placed under the first row only, so appears not to be looping through each row, sample below.
XX278 Barco
XX004
XX004
XX278
XX004
XX004
XX278
XX278
Dim Nu As Range
Dim cmpny As Range
Dim v As Integer
Dim y As Integer
v = ActiveSheet.Rows(1).Find("customer_name", LookAt:=xlPart).End(xlDown).Count - 1
'count number of rows
Set Nu = ActiveSheet.Rows(1).Find("cust_num", LookAt:=xlPart) 'set Nu = cust_num column header
Set cmpny = ActiveSheet.Rows(1).Find("company name", LookAt:=xlPart) 'set cmpny = company name column
For y = 0 To v 'loop through each row
Select Case Nu.Offset(1 + y, 0).Value 'row 1 + y of "cust_num"
Case "XX004", "XX278", "XX318" 'if "cust_num" row = these #'s
cmpny.Offset(1 + y, 0).Value = "Barco" 'Then corresponding row under "company name" column = "Varco"
End Select
Next