best mensen
Laatst heb ik via dit forum een vakantieplanner gevonden die ik wel kon gebruiken met eea aan te passen. Maar nu is er toch iets met de code niet goed. Eerst werkte het goed, hier onder de code zouden jullie er es kritisch naar willen kijken? graag hoor ik wat ik fout gedaan heb.
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Medw = ComboBox1.Value
Datum1 = ComboBox2.Value
Datum2 = ComboBox3.Value
test = Range("C3").Value
With Sheets("1e Kwartaal").Range("B13:B113")
Set a = .Find(Medw, LookIn:=xlValues, lookat:=xlWhole)
If Not a Is Nothing Then
vRij = a.Row
With Sheets("1e kwartaal").Range("F12:CR12")
Set b = .Find(Datum1, LookIn:=xlValues, lookat:=xlPart)
If Not b Is Nothing Then
kRij1 = b.Column
Set c = .Find(Datum2, LookIn:=xlValues, lookat:=xlPart)
If Not c Is Nothing Then
kRij2 = c.Column
End If
End If
End With
rBereik1 = Cells(vRij, kRij1).Address
rBereik2 = Cells(vRij, kRij2).Address
Range(rBereik1, rBereik2).Select
Selection.Interior.ColorIndex = 4
Selection.Interior.Pattern = xlSolid
End If
End With
Range("A1").Select
Unload Me
Application.ScreenUpdating = True
End Sub
Laatst heb ik via dit forum een vakantieplanner gevonden die ik wel kon gebruiken met eea aan te passen. Maar nu is er toch iets met de code niet goed. Eerst werkte het goed, hier onder de code zouden jullie er es kritisch naar willen kijken? graag hoor ik wat ik fout gedaan heb.
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Medw = ComboBox1.Value
Datum1 = ComboBox2.Value
Datum2 = ComboBox3.Value
test = Range("C3").Value
With Sheets("1e Kwartaal").Range("B13:B113")
Set a = .Find(Medw, LookIn:=xlValues, lookat:=xlWhole)
If Not a Is Nothing Then
vRij = a.Row
With Sheets("1e kwartaal").Range("F12:CR12")
Set b = .Find(Datum1, LookIn:=xlValues, lookat:=xlPart)
If Not b Is Nothing Then
kRij1 = b.Column
Set c = .Find(Datum2, LookIn:=xlValues, lookat:=xlPart)
If Not c Is Nothing Then
kRij2 = c.Column
End If
End If
End With
rBereik1 = Cells(vRij, kRij1).Address
rBereik2 = Cells(vRij, kRij2).Address
Range(rBereik1, rBereik2).Select
Selection.Interior.ColorIndex = 4
Selection.Interior.Pattern = xlSolid
End If
End With
Range("A1").Select
Unload Me
Application.ScreenUpdating = True
End Sub