Skip to main content

AccessTr.neT


Access Tablo Makro Olayı

Access Tablo Makro Olayı

#11
Bu videoda sanırım tam anlatabildim.Yani Access tabloyu Excel gibi düşünebilirsiniz videoya göre.






Kodlarda aşağıda excelin.Kodlar A,B ve C sütununa tıklayınca çalışıyor.Kabaca hazırladım kodları test amaçlı video için.

Kod:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    Dim scr As New Scripting.Dictionary
    Dim i As Integer

'--------------------------A sütununa göre------------------------------------------

    If Not Intersect([A:A], Target) Is Nothing Then
        For i = 1 To Cells(Rows.Count, 1).End(3).Row
          If Cells(i, 1).Value <> "" Then scr(Cells(i, 1).Value) = scr(Cells(i, 1).Value)
        Next

        With Selection.Validation
            .Delete
          On Error GoTo var1
            .Add Type:=xlValidateList, Formula1:=Application.Transpose(Join(scr.Keys, ","))
            .IgnoreBlank = True
            .InCellDropdown = True
            .InputTitle = ""
            .ErrorTitle = ""
            .InputMessage = ""
            .ErrorMessage = ""
            .ShowInput = False
            .ShowError = False
            GoTo son
var1:
If scr.Count = 0 Then GoTo son
If Target.Offset(0, -1).Value = "" Then GoTo son
        .Add Type:=xlValidateList, Formula1:=Target.Offset(0, -1).Value
   
        End With
    End If
'--------------------------B sütununa göre------------------------------------------

    If Not Intersect([B:B], Target) Is Nothing Then
        For i = 1 To Cells(Rows.Count, 1).End(3).Row
            If Target.Offset(0, -1).Value = Cells(i, 1).Value Then
              If Cells(i, 2).Value <> "" Then
                    scr(Cells(i, 2).Value) = scr(Cells(i, 2).Value)
              End If
            End If
        Next
       
 
        With Selection.Validation
            .Delete
        On Error GoTo var2
          If scr.Count = 0 Then GoTo son
            .Add Type:=xlValidateList, Formula1:=Application.Transpose(Join(scr.Keys, ","))
            .IgnoreBlank = True
            .InCellDropdown = True
            .InputTitle = ""
            .ErrorTitle = ""
            .InputMessage = ""
            .ErrorMessage = ""
            .ShowInput = False
            .ShowError = False
            GoTo son
var2:
        If Target.Offset(0, -1).Value = "" Then GoTo son
        .Add Type:=xlValidateList, Formula1:=Target.Offset(0, -1).Value
        End With
    End If

'--------------------------C sütununa göre------------------------------------------
    If Not Intersect([C:C], Target) Is Nothing Then
        For i = 1 To Cells(Rows.Count, 1).End(3).Row
            If Target.Offset(0, -2).Value & "|" & Target.Offset(0, -1).Value = _
              Cells(i, 1).Value & "|" & Cells(i, 2).Value Then
                If Cells(i, 3).Value <> "" Then
                    scr(Cells(i, 3).Value) = scr(Cells(i, 3).Value)
                End If
            End If
        Next
       
     
        With Selection.Validation
            .Delete
          On Error GoTo var3
          If scr.Count = 0 Then GoTo son
            .Add Type:=xlValidateList, Formula1:=Application.Transpose(Join(scr.Keys, ","))
            .IgnoreBlank = True
            .InCellDropdown = True
            .InputTitle = ""
            .ErrorTitle = ""
            .InputMessage = ""
            .ErrorMessage = ""
            .ShowInput = False
            .ShowError = False
            GoTo son
var3:
      If Target.Offset(0, -1).Value = "" Then GoTo son
        .Add Type:=xlValidateList, Formula1:=Target.Offset(0, -1).Value
        End With

       
    End If

son:

    Set scr = Nothing
End Sub

Cevapla

Bir hesap oluşturun veya yorum yapmak için giriş yapın

Yorum yapmak için üye olmanız gerekiyor

ya da

Bu Konudaki Yorumlar
Access Tablo Makro Olayı - Yazar: feraz - 06/02/2020, 23:43
Cvp: Access Tablo Makro Olayı - Yazar: feraz - 07/02/2020, 15:44
Cvp: Access Tablo Makro Olayı - Yazar: feraz - 08/02/2020, 21:20
Cvp: Access Tablo Makro Olayı - Yazar: feraz - 08/02/2020, 23:44
Cvp: Access Tablo Makro Olayı - Yazar: ayhan2122 - 10/02/2020, 18:20
Cvp: Access Tablo Makro Olayı - Yazar: feraz - 10/02/2020, 18:54
Cvp: Access Tablo Makro Olayı - Yazar: mehmetdemiral - 16/02/2020, 15:31
Cvp: Access Tablo Makro Olayı - Yazar: berduş - 10/02/2020, 20:42
Cvp: Access Tablo Makro Olayı - Yazar: feraz - 10/02/2020, 20:57
Cvp: Access Tablo Makro Olayı - Yazar: feraz - 10/02/2020, 21:13
Cvp: Access Tablo Makro Olayı - Yazar: feraz - 10/02/2020, 23:27
Cvp: Access Tablo Makro Olayı - Yazar: feraz - 11/02/2020, 01:17
Cvp: Access Tablo Makro Olayı - Yazar: feraz - 11/02/2020, 15:10
Cvp: Access Tablo Makro Olayı - Yazar: feraz - 16/02/2020, 15:44
Cvp: Access Tablo Makro Olayı - Yazar: mehmetdemiral - 16/02/2020, 17:38
Cvp: Access Tablo Makro Olayı - Yazar: feraz - 16/02/2020, 17:48
Task