Hoi allemaal,
ik heb twee Change codes wat ik wil gebruiken in mijn sheet maar ik weet niet of er een oplossing voor is?
ik wil ze nu in een sheet gebruiken.
Weet iemand een oplossing voor?
ik heb twee Change codes wat ik wil gebruiken in mijn sheet maar ik weet niet of er een oplossing voor is?
ik wil ze nu in een sheet gebruiken.
Weet iemand een oplossing voor?
Code:
Option Explicit
Private Sub Worksheet_Change(ByVal target As Range)
'selectie blokkeren cel
If target.Address(0, 0) = "FI2" Then
Range("U71:EZ72, U94:EZ95, U120:EZ121, U145:EZ146, U169:EZ169, U190:EZ190, U224:EZ245").Locked = IIf(LCase(target.Value) = "ja", True, False)
End If
If target.Address(0, 0) = "FI5" Then
Range("U73:EZ93, U96:EZ119, U122:EZ144, U147:EZ168, U170:EZ189, U191:EZ223, U246:EZ302").Locked = IIf(LCase(target.Value) = "ja", True, False)
End If
If target.Address(0, 0) = "FI9" Then
Range("I47:EZ66").Locked = IIf(LCase(target.Value) = "ja", True, False)
End If
'voor Hoofdletter
If target.Cells.Count > 1 Or target.HasFormula Then Exit Sub
On Error Resume Next
If Not Intersect(target, Range("U71:EW302")) Is Nothing Then
Application.EnableEvents = False
target = StrConv(target, vbUpperCase)
Application.EnableEvents = True
End If
On Error GoTo 0
End Sub
Code:
'voor log bij te houden
Dim PreviousValue
Private Sub Worksheet_Change(ByVal target As Range)
If target.Value <> PreviousValue Then
x = Environ("USERNAME") & "|" & Application.UserName & "|" & " changed cell " & "|" & ActiveSheet.Name & target.Address _
& "|" & PreviousValue & "|" & target.Value & "|" & Date & "|" & Time
Sheets("log").Cells(65000, 1).End(xlUp).Offset(1, 0).Resize(1, 8).Value = Split(x, "|")
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal target As Range)
PreviousValue = target.Value
End Sub
Laatst bewerkt: