3
Private Sub UserForm_Initialize() CevherBox.ColumnCount = 1 CevherBox.RowSource = "SSVG!AL2:AL" & Sheets("SSVG").Cells(38, 2).Value + 30 End Sub Private Sub CevherBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean) Range(Hedef).Value = CevherBox.Value Unload CevherForm End Sub Private Sub CevherBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If KeyAscii = 13 Then Range(Hedef).Value = CevherBox.Value Unload CevherForm ElseIf KeyAscii = 27 Then Unload CevherForm End If End Sub

code about the excel forms

Embed Size (px)

DESCRIPTION

excel vba codes for the form usafe

Citation preview

Page 1: code about the excel forms

Private Sub UserForm_Initialize()

CevherBox.ColumnCount = 1

CevherBox.RowSource = "SSVG!AL2:AL" & Sheets("SSVG").Cells(38, 2).Value + 30

End Sub

Private Sub CevherBox_DblClick(ByVal Cancel As MSForms.ReturnBoolean)

Range(Hedef).Value = CevherBox.Value

Unload CevherForm

End Sub

Private Sub CevherBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)

If KeyAscii = 13 Then

Range(Hedef).Value = CevherBox.Value

Unload CevherForm

ElseIf KeyAscii = 27 Then

Unload CevherForm

End If

End Sub

Page 2: code about the excel forms

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Address <> "$C$1" And Target.Address <> "$C$2" And Target.Address <> "$C$3" And Target.Address <> "$C$4" And Target.Address <> "$D$1" And Target.Address <> "$D$2" And Target.Address <> "$D$3" And Target.Address <> "$D$4" And Target.Address <> "$E$1" And Target.Address <> "$E$2" And Target.Address <> "$E$3" And Target.Address <> "$E$4" And Target.Address <> "$H$1" And Target.Address <> "$H$2" And Target.Address <> "$H$3" And Target.Address <> "$H$4" Then

If InStr(1, Target.Address, ":") = 0 And Left(Target.Address, 2) = "$C" Then

Hedef = Target.Address

CevherForm.Show

ElseIf InStr(1, Target.Address, ":") = 0 And Left(Target.Address, 2) = "$D" Then

Hedef = Target.Address

GelenGidenForm.Show

ElseIf InStr(1, Target.Address, ":") = 0 And Left(Target.Address, 2) = "$E" Then

Hedef = Target.Address

GelenGidenForm.Show

ElseIf InStr(1, Target.Address, ":") = 0 And Left(Target.Address, 2) = "$H" Then

Hedef = Target.Address

SevkSatisForm.Show

End If

End If

End Sub