UserForm üzerinde son işaretli tarihin diğer formlardada aktif olması

Katılım
19 Ağustos 2005
Mesajlar
201
Excel Vers. ve Dili
Excel 2003 Tr
Ekli dosyada üç ayrı Form var
Commandbutton tıklanınca birinciForm açılıyor
birinci fomda tarih aralığı işaretlenip ikinci veya üçüncü forma geçiş yaptığımızda geçilen formun üzerindeki takvim tarihinin birinciform da işaretlediğimiz takvimle aynı olmasını sağlamak istiyorum. Aynı şekilde hangi form olursa olsun birinin tarihini değiştirdiğimizde diğer formlara geçişlerde son işaretlediğimiz tarih diğerlerindede aktif olmalı.
 

Zeki Gürsoy

Uzman
Uzman
Katılım
31 Aralık 2005
Mesajlar
4,369
Excel Vers. ve Dili
Office 365 (64 bit) - Türkçe
Public değişken tanımlayabileceğiniz gibi, 3. Form Show ardından
Ör:UserForm3.Montview1 = Me.Montview1 de olabilir.
 
Katılım
19 Ağustos 2005
Mesajlar
201
Excel Vers. ve Dili
Excel 2003 Tr
sayın anemos ekli dosya üzerinde gösterme şansınız varmı bende hata yapıyor. her halde kodu yanlış yere ekliyorum
 

Zeki Gürsoy

Uzman
Uzman
Katılım
31 Aralık 2005
Mesajlar
4,369
Excel Vers. ve Dili
Office 365 (64 bit) - Türkçe
Form1'den 2 ve 3. forma geçerken olacak yapıyı ekledim.

Form 2 geçişi;
Kod:
Private Sub CommandButton1_Click()
Unload UserForm1
'///////////
With UserForm2
    .Calendar1.Value = Me.Calendar1.Value
    .Calendar2.Value = Me.Calendar2.Value
    .Show
End With
'//////////////
Dim i As Long, k As Byte, adrs As String, a As Long
Dim L_sut, M_sut, Z_sut As Double
ListBox1.RowSource = ""
If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData
ReDim myarr(1 To 34, 1 To 1)
For i = 2 To Cells(65536, "I").End(xlUp).Row
    adrs = Range(Cells(i, "B"), Cells(i, "AH")).Address
    If WorksheetFunction.CountA(Range(adrs)) > 0 Then
        If CLng(CDate(Cells(i, "I").Value)) >= CLng(CDate(Calendar1.Value)) _
        And CLng(CDate(Cells(i, "I").Value)) <= CLng(CDate(Calendar2.Value)) Then
            a = a + 1
            ReDim Preserve myarr(1 To 34, 1 To a)
            For k = 1 To 34
                If k = 9 Then
                    myarr(k, a) = Format(Cells(i, k).Value, "dd.mm.yyyy")
                    Else
                    myarr(k, a) = Cells(i, k).Value
                End If
            Next k
            L_sut = L_sut + Cells(i, "L").Value
            M_sut = M_sut + Cells(i, "M").Value
            N_sut = N_sut + Cells(i, "N").Value
            O_sut = O_sut + Cells(i, "O").Value
            P_sut = P_sut + Cells(i, "P").Value
            Q_sut = Q_sut + Cells(i, "Q").Value
            R_sut = R_sut + Cells(i, "R").Value
            S_sut = S_sut + Cells(i, "S").Value
            T_sut = T_sut + Cells(i, "T").Value
            U_sut = U_sut + Cells(i, "U").Value
            V_sut = V_sut + Cells(i, "V").Value
            W_sut = W_sut + Cells(i, "W").Value
            X_sut = X_sut + Cells(i, "X").Value
            Y_sut = Y_sut + Cells(i, "Y").Value
            Z_sut = Z_sut + Cells(i, "Z").Value
       End If
    End If
Next i
ListBox1.Column = myarr
Erase myarr
Label5.Caption = ListBox1.ListCount + 2
Label7.Caption = L_sut
Label9.Caption = M_sut
Label11.Caption = N_sut
Label13.Caption = O_sut
Label15.Caption = P_sut
Label17.Caption = Q_sut
Label19.Caption = R_sut
Label21.Caption = S_sut
Label23.Caption = T_sut
Label25.Caption = U_sut
Label27.Caption = V_sut
Label29.Caption = W_sut
Label31.Caption = X_sut
Label33.Caption = Y_sut
Label35.Caption = Z_sut

End Sub
Form 3 ge&#231;i&#351;i;

Kod:
Private Sub OperasyonButton_Click()
Unload UserForm1
'//////////////
With UserForm3
    .Calendar1.Value = Me.Calendar1.Value
    .Calendar2.Value = Me.Calendar2.Value
    .Show
End With
'//////////////////
    Dim i As Long, k As Byte, adrs As String, a As Long
Dim L_sut, M_sut, Z_sut As Double
ListBox1.RowSource = ""
If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData
ReDim myarr(1 To 34, 1 To 1)
For i = 2 To Cells(65536, "I").End(xlUp).Row
    adrs = Range(Cells(i, "L"), Cells(i, "Z")).Address
    If WorksheetFunction.CountA(Range(adrs)) > 0 Then
        If CLng(CDate(Cells(i, "I").Value)) >= CLng(CDate(Calendar1.Value)) _
        And CLng(CDate(Cells(i, "I").Value)) <= CLng(CDate(Calendar2.Value)) Then
            a = a + 1
            ReDim Preserve myarr(1 To 34, 1 To a)
            For k = 1 To 34
                If k = 9 Then
                    myarr(k, a) = Format(Cells(i, k).Value, "dd.mm.yyyy")
                    Else
                    myarr(k, a) = Cells(i, k).Value
                End If
            Next k
            L_sut = L_sut + Cells(i, "L").Value
            M_sut = M_sut + Cells(i, "M").Value
            N_sut = N_sut + Cells(i, "N").Value
            O_sut = O_sut + Cells(i, "O").Value
            P_sut = P_sut + Cells(i, "P").Value
            Q_sut = Q_sut + Cells(i, "Q").Value
            R_sut = R_sut + Cells(i, "R").Value
            S_sut = S_sut + Cells(i, "S").Value
            T_sut = T_sut + Cells(i, "T").Value
            U_sut = U_sut + Cells(i, "U").Value
            V_sut = V_sut + Cells(i, "V").Value
            W_sut = W_sut + Cells(i, "W").Value
            X_sut = X_sut + Cells(i, "X").Value
            Y_sut = Y_sut + Cells(i, "Y").Value
            Z_sut = Z_sut + Cells(i, "Z").Value
      End If
    End If
Next i
ListBox1.Column = myarr
Erase myarr
Label5.Caption = ListBox1.ListCount
Label7.Caption = L_sut
Label9.Caption = M_sut
Label11.Caption = N_sut
Label13.Caption = O_sut
Label15.Caption = P_sut
Label17.Caption = Q_sut
Label19.Caption = R_sut
Label21.Caption = S_sut
Label23.Caption = T_sut
Label25.Caption = U_sut
Label27.Caption = V_sut
Label29.Caption = W_sut
Label31.Caption = X_sut
Label33.Caption = Y_sut
Label35.Caption = Z_sut

End Sub
 
Son düzenleme:
Katılım
19 Ağustos 2005
Mesajlar
201
Excel Vers. ve Dili
Excel 2003 Tr
Hocam te&#351;ekk&#252;rler mant&#305;&#287;&#305; anlad&#305;m
 
Üst