Option Explicit
Private Sub CboTender_Change()
Dim cel As Range: If CboTender = "" Then Exit Sub
With Worksheets("SOURCE")
.Select: [A1].Select: Application.ScreenUpdating = 0
Set cel = .Columns(1).Find(CboTender, , -4163, 1, 1)
End With
If cel Is Nothing Then Exit Sub
Dim T, chn$, i As Byte
TextBOID = "": TextSegment = "": TextRegion = "": TextCountry = ""
TextScope = "": TextContractDuration = "": TextNTP = ""
TextCAPEX = "": TextOPEX = ""
For i = 0 To 5: LboDetailledScope.Selected(i) = 0: Next i
With Cells(cel.Row, 1)
TextBOID = .Offset(, 1): TextRegion = .Offset(, 2): TextCountry = .Offset(, 3)
TextSegment = .Offset(, 4): TextScope = .Offset(, 5): chn = .Offset(, 6)
If chn <> "" Then
T = Split(chn, ";")
For i = 0 To UBound(T): LboDetailledScope.Selected(T(i) - 1) = True: Next i
End If
TextContractDuration = .Offset(, 7): TextNTP = .Offset(, 8)
TextCAPEX = Format(.Offset(, 9), "Currency")
TextOPEX = Format(.Offset(, 10), "Currency")
End With
End Sub
Private Sub BtnModify_Click()
Dim cel As Range: If CboTender = "" Then Exit Sub
With Worksheets("SOURCE")
.Select: [A1].Select: Application.ScreenUpdating = 0
Set cel = .Columns(1).Find(CboTender, , -4163, 1, 1)
End With
If cel Is Nothing Then Exit Sub
Dim chn$, i As Byte
With Cells(cel.Row, 1)
.Offset(, 1) = TextBOID: .Offset(, 2) = TextRegion: .Offset(, 3) = TextCountry
.Offset(, 4) = TextSegment: .Offset(, 5) = TextScope
.Offset(, 7) = TextContractDuration: .Offset(, 8) = TextNTP
.Offset(, 9) = TextCAPEX: .Offset(, 10) = TextOPEX
For i = 0 To 5
If LboDetailledScope.Selected(i) Then chn = chn & i + 1 & ";"
Next i
i = Len(chn): If i > 0 Then .Offset(, 6) = Left$(chn, i - 1)
End With
Application.ScreenUpdating = -1
End Sub
Private Sub BtnClose_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
LblMessage = "Please select the Tender Name in the database"
LboDetailledScope.List = [Liste!O2:O7].Value
End Sub