I have the following code and I think the ElseIf checks the same cells as the initial If and overwrites the cells the initial If altered. I assume this has to do with the difference in condition (string check vs. rowheight).
Any input to addres the problem is highly appreciated.
Dim row As Long
row = 2
Const colSelected As Long = 67, belang As Long = 71, colPref1 As Long = 74, _
colPref2 As Long = 78, colPref3 As Long = 82
Set rngOutput = WsStam.Range("FC2")
Set opmerking = WsStam.Range("FB2")
With WsStam
lastRowInput = .Cells(.Rows.Count, colSelected).End(xlUp).row
Do Until row > lastRowInput
If .Cells(row, belang).Value = "Nee" Then
rngOutput.Value = 0
opmerking.Value = "Geen Belangstelling"
ElseIf .Cells(row, colSelected).RowHeight > 0 Then
Select Case .Cells(row, colSelected).Value
Case .Cells(row, colPref1).Value
rngOutput.Value = 0
Case .Cells(row, colPref2).Value
rngOutput.Value = 1
opmerking.Value = Voorkeur2
Case .Cells(row, colPref3).Value
rngOutput.Value = 1
opmerking.Value = Voorkeur3
Case Else
rngOutput.Value = 1
opmerking.Value = "Functiereeks"
End Select
Set rngOutput = rngOutput(2)
Set opmerking = opmerking(2)
End If
row = row + 1
Loop
End With
Aucun commentaire:
Enregistrer un commentaire