Hello everybody ,
I am fairly new to Excel VBA and i struggle to figure out how to pass a variable from the worksheet_change to a module where the variable is picked up and is printed.
I hope you guys can help me.
I am fairly new to Excel VBA and i struggle to figure out how to pass a variable from the worksheet_change to a module where the variable is picked up and is printed.
I hope you guys can help me.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("C3").Value = "YES" Then
Ergebnis = "XXX"
ElseIf Range("C3").Value = "NO" Then
Range("C4").Locked = False
If Range("C4").Value = "NO" Then
Ergebnis = "ZZZ"
ElseIf Range("C4").Value = "YES" Then
Range("C5").Locked = False
Range("C6").Locked = False
Range("C7").Locked = False
If Range("C5").Value = "YES" Or Range("C6").Value = "YES" Or Range("C7").Value = "YES" Then
Range("C8").Locked = False
Range("C9").Locked = False
Range("C10").Locked = False
Range("C11").Locked = False
Range("C12").Locked = False
Range("C13").Locked = False
Range("C14").Locked = False
Range("C15").Locked = False
End If
End If
End If
End Sub
Sub Button_Ident_Click()
Sheets("Identification").Select
Range("c3").Select
Ergebnis = Empty
Range("c3").Select
Beginn = MsgBox("This Object is /n: " & Ergebnis, vbOKOnly, "The Result is")
Range("e1").Value = Ergebnis
Sheets("PRINT").Select
Range("e31").Value = Ergebnis
End Sub