In the below code, I have the result from a combobox being compared to a range and if there is a match, to place the row number into another cell. I then convert this number into the name of a company.
As I am continuously adding new companies to the list, I would like my program to become more flexible. Perhaps using a name for the range would be better, but I am confused as to how to do this (since I am only a novice). Also, it there a way to directly put the name of the company into a cell as opposed to the number of the row?
Sub COMPANY_INFO()
Dim C As Integer
Dim i As Integer
For C = 260 To 398
If cmb_Menu2.Value = CStr(Worksheets("Data"
.Cells(C, 2).Value) Then
i = C
Worksheets("Data"
.Range("CompaniesControl"
.Value = i ''''''''''''''''''''''''
End If
Next
End Sub
As I am continuously adding new companies to the list, I would like my program to become more flexible. Perhaps using a name for the range would be better, but I am confused as to how to do this (since I am only a novice). Also, it there a way to directly put the name of the company into a cell as opposed to the number of the row?
Sub COMPANY_INFO()
Dim C As Integer
Dim i As Integer
For C = 260 To 398
If cmb_Menu2.Value = CStr(Worksheets("Data"
i = C
Worksheets("Data"
End If
Next
End Sub