Skip to main content

AccessTr.neT


Liste Alma Sorunu

Liste Alma Sorunu

#7
tam olarak sisteminiz anlayamadım ama aşağıdaki kod işinize yarayabilir
Private Sub UserForm_Initialize()
Dim Sql As String
Dim Cn As Object
Dim Rs As Object
Dim SyfEkle As String

SyfEkle = ""
For Each syf In Worksheets
If LCase(syf.Name) = LCase(syf.Range("A1").Value) Then
SyfEkle = SyfEkle & ",'" & syf.Name & "'"
End If
Next syf
SyfEkle = Mid(SyfEkle, 2)
Debug.Print "SyfEkle init", SyfEkle
Set Cn = CreateObject("Adodb.Connection")
Cn.ConnectionString = "provider=Microsoft.ACE.OLEDB.12.0;data source=" & _
ThisWorkbook.FullName & ";extended properties=""excel 8.0;hdr=no"""
Cn.Open

SQL = "select * from [liste$A2Lol] where [F1]<>'' and [F1] in (" & SyfEkle & ") order by [F1]"
Set Rs = CreateObject("adodb.recordset")
Rs.Open SQL, Cn, 3, 1
ListBox1.Column = Rs.GetRows 'RowSource = "liste!a1:F65536"
Rs.Close
Set Rs = Nothing
End Sub
Cevapla
#8
Hocan mesaj7 deki kodu ekleyince hata veriyor.
Son Düzenleme: 11/05/2020, 23:53, Düzenleyen: m_demir.
Cevapla
#9
dosyanızı indirip UserForm_Initialize() fonksiyonunu silip 7. Mesajdaki kodu ekledim, başka hiçbir şey yapmadan form1i açıp rapor al düğmesine bastım hata vermeden çalıştı
Cevapla
#10
Alttaki gibi değiştiriseniz hen 2.satırdan başlar hemde sayfa1 harici listelenir.Alttoplam olayını tam açıklamanız gerekmektedir.
Private Sub UserForm_Initialize()
    Dim son As Integer
   
    ActiveSheet.Unprotect "4455"
    Application.ScreenUpdating = False
    Set SÝ = Sheets("liste")
    SÝ.[A2Lol1000].ClearContents
    SAT = 1
    For Z = 2 To Sheets.Count
    If LCase(Sheets(Z).Name) <> "sayfa1" Then
    SÝ.Cells(SAT + 1, 1) = Sheets(Z).[a1].Value
    SÝ.Cells(SAT + 1, 2) = Sheets(Z).[G5].Value
    SÝ.Cells(SAT + 1, 3) = Sheets(Z).[ý5].Value
    SÝ.Cells(SAT + 1, 4) = Sheets(Z).[K4].Value
   
    SAT = SAT + 1
    End If
Next
    'son = Cells(65536, "f").End(xlUp).Row + 1
'Cells(son, "g") = WorksheetFunction.Sum(Range("f3:f65536"))
'Cells(son, "ý") = WorksheetFunction.Sum(Range("e3:e65536"))
'Cells(son, "ý") = WorksheetFunction.Sum(Range("d3:d65536"))

    Application.ScreenUpdating = True
    'MsgBox "AKTARMA ÝÞLEMÝ TAMAMLANMIÞTIR." & vbCrLf & vbCrLf
    ActiveSheet.Protect "4455"
   
    son = Sheets("liste").Cells(Rows.Count, 1).End(3).Row
    If son > 1 Then ListBox1.RowSource = "liste!A2:F" & son
End Sub
Cevapla
#11
Hocam UserForm3 de ve liste sayfasında alt toplamları almıyor.
Cevapla
#12
(12/05/2020, 00:11)m_demir yazdı: Hocam UserForm3 de ve liste sayfasında alt toplamları almıyor.
Alttoplamlar nereye alınacak sorun bu.Alttoplamlar diye alan yada textbox gibi şeyler yok.
Cevapla

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

Yorum yapmak için üye olmanız gerekiyor

ya da