Skip to main content

AccessTr.neT


Puantaj Makro Çalışması

Puantaj Makro Çalışması

#3
Merhaba.
Kodu alttaki gibi değiştirin.
Son sütun no tam bulunamıyor kodda birleştirmeden dolayı galiba.
Ben Const sonSutun As String = "AY" olarak ekleme yaptım gerekirse değiştirin orayı.

Private Sub CommandButton2_Click() 'kaydet

Dim son As Long, son2 As Long, i 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
Dim sonSutun As Integer
yol = ""
Const basSatir As Integer = 41
Const secim As Integer = 31
Const ilksutun As Integer = 6
Const sonSutun As String = "AY"

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


son2 = Cells(Rows.Count, 1).End(3).Row
If son2 < basSatir Then GoTo son

For i = basSatir To son2
'    If Not IsNumeric(Cells(i, 1).Value) Then: son = i - 1: Exit For
    If Val(Cells(i, 1).Value) = 0 Then: son = i - 1: Exit For
Next

'dosya = ThisWorkbook.Path & Application.PathSeparator & e13 & ".xlsx"
dosya = ThisWorkbook.Path & Application.PathSeparator & Format(e13, "Mesai 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
            If kontroluzunluk(d31) = True Then GoTo son
            Set wb = Workbooks.Add
            Set ws = wb.Sheets(1)
            ws.Name = d31
        Else 'Klasörde E13 deki veri ile ayni isimde Excel yokvarsasa
            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
                If kontroluzunluk(d31) = True Then GoTo son
                wb.Sheets.Add
                Set ws = wb.ActiveSheet
                ws.Name = d31
            Else 'Kapali excelde D31 deki adla ayni isimd sayfa varsa
                Set ws = wb.Worksheets(d31)
            End If
        End If

ThisWorkbook.Activate

Application.DisplayAlerts = False
ws.Cells.Clear
Range(Cells(secim, "A"), Cells(son, sonSutun)).Copy ws.Range("A1")
Range(Cells(secim, "A"), Cells(son, sonSutun)).Copy
ws.Range("A1").PasteSpecial xlPasteColumnWidths
ws.Range("A1").PasteSpecial xlPasteValuesAndNumberFormats

wb.SaveAs Filename:=ThisWorkbook.Path & Application.PathSeparator & Format(e13, "Mesai mmmm yyyy") & ".xlsx"
'wb.SaveAs Filename:=yol & Application.PathSeparator & Format(e13, "mmmm yyyy") & ".xlsx"
wb.Close

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