Skip to main content

AccessTr.neT


Puantaj Makro Çalışması

Puantaj Makro Çalışması

#9
Merhaba Kayıtlı Mesai getir butonuna tıklayınca mı hata veriyor. Bende tıklayınca hata verdi kodu bu şekilde düzeltince çözüm oldu.

Kod:
Private Sub CommandButton3_Click() 'Mesai kaydı getir
Dim son As Long, syfAra As Worksheet
Dim wb As Workbook, ws As Worksheet, dosya As String, say As Integer
Dim d31 As String, e13 As String, yol As String


d31 = Range("D31").Value
e13 = Range("E13").Value

'dosya = ThisWorkbook.Path & Application.PathSeparator & e13 & ".xlsx"
dosya = ThisWorkbook.Path & Application.PathSeparator & Format(e13, "mmmm yyyy") & ".xlsx"
'dosya = yol & Application.PathSeparator & Format(e13, "mmmm yyyy") & ".xlsx"

say = 0
        If Dir(dosya) <> "" Then 'Klasörde E13 deki veri ile ayni isimde excel yoksa
            Set wb = Workbooks.Open(dosya)
            For Each syfAra In wb.Worksheets
               If syfAra.Name = d31 Then
                  say = say + 1
                  Exit For
               End If
            Next
        
            If say > 0 Then 'Kapali excelde D31 deki adla ayni isimd sayfa yoksa
                Set ws = wb.Worksheets(d31)
            Else
                MsgBox d31 & vbNewLine & "Bulunamadi.." _
                     , vbCritical, "Hata": wb.Close 0: GoTo son
            End If
        Else
            MsgBox Format(e13, "mmmm yyyy") & ".xlsx" & vbNewLine & "Bulunamadi.." _
                     , vbCritical, "Hata": wb.Close 0: GoTo son
            
        End If

son = ws.Cells(Rows.Count, 1).End(3).Row

With ws
    Application.DisplayAlerts = False
    .Range(.Cells(5, "F"), .Cells(son, "aj")).Copy
     ThisWorkbook.Activate
    Range("F41").PasteSpecial xlPasteValuesAndNumberFormats
End With
wb.Close 0

Application.CutCopyMode = False
Set wb = Nothing: Set ws = Nothing
Application.DisplayAlerts = True
son:

Application.CutCopyMode = False
Set wb = Nothing: Set ws = Nothing
Application.DisplayAlerts = True
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
Puantaj Makro Çalışması - Yazar: merttr07 - 16/12/2021, 18:43
RE: Puantaj Makro Çalışması - Yazar: berduş - 16/12/2021, 23:33
RE: Puantaj Makro Çalışması - Yazar: feraz - 17/12/2021, 00:13
RE: Puantaj Makro Çalışması - Yazar: merttr07 - 17/12/2021, 10:58
RE: Puantaj Makro Çalışması - Yazar: merttr07 - 17/12/2021, 12:08
RE: Puantaj Makro Çalışması - Yazar: lemoncher2 - 17/12/2021, 12:31
Re: Puantaj Makro Çalışması - Yazar: merttr07 - 17/12/2021, 13:35
RE: Puantaj Makro Çalışması - Yazar: merttr07 - 24/12/2021, 11:09
RE: Puantaj Makro Çalışması - Yazar: lemoncher2 - 28/12/2021, 15:49
RE: Puantaj Makro Çalışması - Yazar: merttr07 - 06/01/2022, 11:37
RE: Puantaj Makro Çalışması - Yazar: lemoncher2 - 06/01/2022, 22:54
RE: Puantaj Makro Çalışması - Yazar: merttr07 - 07/01/2022, 12:14
RE: Puantaj Makro Çalışması - Yazar: lemoncher2 - 07/01/2022, 19:49
RE: Puantaj Makro Çalışması - Yazar: merttr07 - 10/01/2022, 12:17
RE: Puantaj Makro Çalışması - Yazar: lemoncher2 - 10/01/2022, 18:21
RE: Puantaj Makro Çalışması - Yazar: merttr07 - 11/01/2022, 13:20
RE: Puantaj Makro Çalışması - Yazar: lemoncher2 - 11/01/2022, 19:38
RE: Puantaj Makro Çalışması - Yazar: merttr07 - 17/01/2022, 10:13
RE: Puantaj Makro Çalışması - Yazar: lemoncher2 - 17/01/2022, 12:55
RE: Puantaj Makro Çalışması - Yazar: merttr07 - 17/01/2022, 17:03
RE: Puantaj Makro Çalışması - Yazar: lemoncher2 - 17/01/2022, 17:27
RE: Puantaj Makro Çalışması - Yazar: merttr07 - 21/01/2022, 16:13
Task