- Katılım
- 21 Aralık 2018
- Mesajlar
- 25
- Excel Vers. ve Dili
- EXCEL-2016 TÜRKÇE
1. MAKRO
Private Sub Worksheet_change(ByVal Target As Range)
Dim RaBereich As Range, RaZelle As Range
Application.EnableEvents = False
Set RaBereich = Range("B3:C3")
Application.EnableEvents = False
For Each RaZelle In Range(Target.Address)
If Not Intersect(RaZelle, RaBereich) Is Nothing Then
RaZelle.Value = UCase(RaZelle.Value)
End If
Next RaZelle
Application.EnableEvents = True
Set RaBereich = Nothing
Dim hucre As Range, say As Long
Dim sut_adr As String, sat_adr As String
On Error GoTo hata
If Intersect(Target, [B:C]) Is Nothing Then Exit Sub
If Target.Value = "" Then Exit Sub
sut_adr = Range(Cells(1, Target.Column), Cells(Cells(65536, Target.Column).End(xlUp).Row, Target.Column)).Address
sat_adr = Range(Cells(Target.Row, 1), Cells(Target.Row, 3)).Address
For Each hucre In Range(sut_adr)
If hucre.Value = Target.Value Then say = say + 1
If say >= 2 Then
MsgBox "GİRDİĞİNİZ CARİ KAYITLIDIR..." & _
vbLf & "", vbCritical, "Mükerrer Kayıt Hatası"
Target.Value = Empty
Cancel = True
Exit Sub
End If
Next
For Each hucre In Range(sat_adr)
If hucre.Value = Target.Value Then say = say + 1
If say >= 3 Then
MsgBox " GİRDİĞİNİZ CARİ KAYITLIDIR..." & _
vbLf & "", vbCritical, "Mükerrer Kayıt Hatası"
Target.Value = Empty
Cancel = True
Exit Sub
End If
Next
hata:
End Sub
2. MAKRO
Private Sub Worksheet_Deactivate()
Range("B5:I" & Rows.Count).Sort Range("B5"), xlAscending
End Sub
Arkadaşlar bu iki makroyu aynı sayfada nasıl çalıştırabilirim. Yardım lütfen
Private Sub Worksheet_change(ByVal Target As Range)
Dim RaBereich As Range, RaZelle As Range
Application.EnableEvents = False
Set RaBereich = Range("B3:C3")
Application.EnableEvents = False
For Each RaZelle In Range(Target.Address)
If Not Intersect(RaZelle, RaBereich) Is Nothing Then
RaZelle.Value = UCase(RaZelle.Value)
End If
Next RaZelle
Application.EnableEvents = True
Set RaBereich = Nothing
Dim hucre As Range, say As Long
Dim sut_adr As String, sat_adr As String
On Error GoTo hata
If Intersect(Target, [B:C]) Is Nothing Then Exit Sub
If Target.Value = "" Then Exit Sub
sut_adr = Range(Cells(1, Target.Column), Cells(Cells(65536, Target.Column).End(xlUp).Row, Target.Column)).Address
sat_adr = Range(Cells(Target.Row, 1), Cells(Target.Row, 3)).Address
For Each hucre In Range(sut_adr)
If hucre.Value = Target.Value Then say = say + 1
If say >= 2 Then
MsgBox "GİRDİĞİNİZ CARİ KAYITLIDIR..." & _
vbLf & "", vbCritical, "Mükerrer Kayıt Hatası"
Target.Value = Empty
Cancel = True
Exit Sub
End If
Next
For Each hucre In Range(sat_adr)
If hucre.Value = Target.Value Then say = say + 1
If say >= 3 Then
MsgBox " GİRDİĞİNİZ CARİ KAYITLIDIR..." & _
vbLf & "", vbCritical, "Mükerrer Kayıt Hatası"
Target.Value = Empty
Cancel = True
Exit Sub
End If
Next
hata:
End Sub
2. MAKRO
Private Sub Worksheet_Deactivate()
Range("B5:I" & Rows.Count).Sort Range("B5"), xlAscending
End Sub
Arkadaşlar bu iki makroyu aynı sayfada nasıl çalıştırabilirim. Yardım lütfen
