Const ColGroup = 4
Const ColLevel = 4
Const ColAdvisor = 6
Const ColInitial = 7
Option Explicit
Private Sub BtnAdd_Click()
Dim NbRangeLog As Integer
Dim i As Integer
Dim wsLog As Object
With wsLog
NbRangeLog = .Columns(1).End(xlDown).Row
For i = 1 To NbRangeLog
.Cells(i, ColAdvisor).Value = ReturnAdvisor(.Cells(i, ColGroup).Value, .Cells(i, ColLevel).Value)
.Cells(i, ColInitial).Value = ReturnInitial(.Cells(i, ColAdvisor).Value)
Next i
End With
End Sub
Private Sub BtnReset_Click()
wsLog.Columns(ColAdvisor).Clear
wsLog.Cells(1, ColAdvisor).Value = "Advisors"
wsLog.Columns(ColInitial).Clear
wsLog.Cells(1, ColInitial).Value = "Initials"
End Sub
Option Explicit
Public Function ReturnAdvisor(Group As String, Level As String) As String
Dim MyRow As Range
ReturnAdvisor = ""
For Each MyRow In Range("list_Advisor").Rows
If Left(MyRow.Cells(1).Value, 2) = Group And Right(MyRow.Cells(1).Value, 2) = Level Then
ReturnAdvisor = MyRow.Cells(1).Value
End If
Next MyRow
End Function
Public Function ReturnInitial(Name As String) As String
ReturnInitial = FindInitialAdvisor(Name, wsLis.Cells(1, 1))
End Function
Public Function FindInitialAdvisor(Name As String, Cell_list As Range) As Integer
Select Case Cell_list.Value
Case Name
FindInitialAdvisor = Cell_list.Offset(columnoffset:=1, rowoffset:=1).Value
Case ""
FindInitialAdvisor = ""
Case Else
FindInitialAdvisor = FindInitialAdvisor(Name, Cell_list.Offset(rowoffset:=1, columnoffset:=0))
End Select
End Function
my code isnt compling