DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Merhaba,
Sorudaki amaçınızı ben anlayamadım. Daha detaylı açıklarmısınız.
Bu açıklamaları konunun başını atlayarak mı yaptınız. Yada ben biryeri mi kaçıyorum.
Tarih aralığı berlileyeceksiniz ve bu aralık 4 - 5 ve 6. satırlara sizin yazdığınız format gibi yazılacak doğru mu?
Eğer doğru ise tarih aralığını nerden belirliyorsunuz. Bunun için kullandığınız hücre var mı?
Merhaba
Eki inceleyiniz_?
hocam çok teşekkürler
harika olmuş
Sub Duzenle()
Dim i As Double, sont As Date, ilk As Integer, c As Range, d As Range
Dim sut As Integer, bul As Date, a As Byte
Dim k As Byte, b As Byte, t As Integer
sut = Cells(15, Columns.Count).End(xlToLeft).Column: ilk = 2
Application.ScreenUpdating = False
Range(Cells(13, 2), Cells(14, sut)).Clear
For i = Range("B15") To Cells(15, Columns.Count).End(xlToLeft).Value
k = WorksheetFunction.RoundUp(Month(i) / 3, 0)
sont = DateSerial(Year(i), Month(i) + 1, 0)
If Format(Cells(15, sut), "mmmm.yyyy") = _
Format(sont, "mmmm.yyyy") Then sont = Cells(15, sut): a = 1
Set c = Rows(15).Find(sont, LookIn:=xlFormulas, LookAt:=xlWhole)
If Not c Is Nothing Then
With Range(Cells(14, ilk), Cells(14, c.Column))
.Merge
.Borders.LineStyle = 1
.HorizontalAlignment = xlCenter
End With
Cells(14, ilk) = Format(sont, "mmmm.yyyy")
End If
If k <> b Then
bul = DateSerial(Year(i), k * 3 + 1, 0)
Set d = Rows(15).Find(bul, LookIn:=xlFormulas, LookAt:=xlWhole)
If Not d Is Nothing Then t = d.Column Else t = sut
With Range(Cells(13, ilk), Cells(13, t))
.Merge
.Borders.LineStyle = 1
.HorizontalAlignment = xlCenter
End With
Cells(13, ilk) = k & " ÇEYREK " & Format(i, "yyyy")
End If
i = sont + 1: ilk = c.Column + 1: b = k
If a = 1 Then Exit Sub
Next i
Application.ScreenUpdating = True
End Sub
Case "10"
KL = Format(S1.Cells(15, STN), "mmmm.yyyy")
KL1 = "4. Çeyrek " & Format(S1.Cells(15, STN), "yyyy")
If .IsText(S1.Cells(15, STN - 1)) = False Then
If Month(S1.Cells(15, STN - 1)) = 11 Then
S1.Range(S1.Cells(14, STN - 1).Address & ":" & S1.Cells(14, STN).Address).Merge
S1.Range(S1.Cells(14, STN - 1).Address & ":" & S1.Cells(14, STN).Address) = KL
[COLOR="Red"]If Month(S1.Cells(15, STN)) >= 10 And Month(S1.Cells(15, STN)) <= 12 Then[/COLOR]
S1.Range(S1.Cells(13, STN - 1).Address & ":" & S1.Cells(13, STN).Address).Merge
S1.Range(S1.Cells(13, STN - 1).Address & ":" & S1.Cells(13, STN).Address) = KL1
ElseIf Month(S1.Cells(15, STN - 1)) = 10 Then
S1.Range(S1.Cells(13, STN - 1).Address & ":" & S1.Cells(13, STN).Address).Merge
S1.Range(S1.Cells(13, STN - 1).Address & ":" & S1.Cells(13, STN).Address) = KL1
End If: End If
Else
S1.Range(S1.Cells(14, STN).Address).Merge
End If
Case "10"
KL = Format(S1.Cells(15, STN), "mmmm.yyyy")
KL1 = "4. Çeyrek " & Format(S1.Cells(15, STN), "yyyy")
If .IsText(S1.Cells(15, STN - 1)) = False Then
If Month(S1.Cells(15, STN - 1)) = 11 Then
S1.Range(S1.Cells(14, STN - 1).Address & ":" & S1.Cells(14, STN).Address).Merge
S1.Range(S1.Cells(14, STN - 1).Address & ":" & S1.Cells(14, STN).Address) = KL
S1.Range(S1.Cells(13, STN - 1).Address & ":" & S1.Cells(13, STN).Address).Merge
S1.Range(S1.Cells(13, STN - 1).Address & ":" & S1.Cells(13, STN).Address) = KL1
ElseIf Month(S1.Cells(15, STN - 1)) = 10 Then
[COLOR="Red"]If Month(S1.Cells(15, STN)) >= 10 And Month(S1.Cells(15, STN)) <= 12 Then[/COLOR]
S1.Range(S1.Cells(13, STN - 1).Address & ":" & S1.Cells(13, STN).Address).Merge
S1.Range(S1.Cells(13, STN - 1).Address & ":" & S1.Cells(13, STN).Address) = KL1
End If: End If
Else
S1.Range(S1.Cells(14, STN).Address).Merge
End If
Ömer hocam
sizin çalışmasınızla ilgili olarak
Farklı bir şekilde test ettiğimde, hız açısında 1 saniye daha hızlı. Fakat tarihleri formülle artırarak yaptığımızda hata veriyor
Hata olarak Dim değişken tanımlamasında "c As Date"
hatayı oluşturduğu yer Wiht boluğunda oluşuyor. Normal olarak yazdığımızda sıkıntı yok, eğer tarihi formülle arttırarak gider isek hata veriyor.
i = sont + 1: ilk = c.Column + 1: b = k burada sıkıntı yapıyor
saygılarımla
Sub Duzenle()
Dim i As Double, sont As Date, ilk As Integer, x As Integer
Dim sut As Integer, bul As Date, a As Byte, Wf As WorksheetFunction
Dim k As Byte, b As Byte, t As Integer
sut = Cells(15, Columns.Count).End(xlToLeft).Column: ilk = 2
Set Wf = WorksheetFunction
Application.ScreenUpdating = False
Range(Cells(13, 2), Cells(14, sut)).Clear
For i = Range("B15") To Cells(15, Columns.Count).End(xlToLeft).Value
k = WorksheetFunction.RoundUp(Month(i) / 3, 0)
sont = DateSerial(Year(i), Month(i) + 1, 0)
If Format(Cells(15, sut), "mmmm.yyyy") = _
Format(sont, "mmmm.yyyy") Then sont = Cells(15, sut): a = 1
If Wf.CountIf(Rows(15), sont) > 0 Then
x = Wf.Match(CDbl(sont), Rows(15), 0)
With Range(Cells(14, ilk), Cells(14, x))
.Merge
.Borders.LineStyle = 1
.HorizontalAlignment = xlCenter
End With
Cells(14, ilk) = Format(sont, "mmmm.yyyy")
End If
If k <> b Then
bul = DateSerial(Year(i), k * 3 + 1, 0)
If Wf.CountIf(Rows(15), bul) > 0 Then
t = Wf.Match(CDbl(bul), Rows(15), 0)
Else
t = sut
End If
With Range(Cells(13, ilk), Cells(13, t))
.Merge
.Borders.LineStyle = 1
.HorizontalAlignment = xlCenter
End With
Cells(13, ilk) = k & " ÇEYREK " & Format(i, "yyyy")
End If
i = sont + 1: ilk = x + 1: b = k
If a = 1 Then Exit Sub
Next i
Application.ScreenUpdating = True
End Sub
Sayın cengizank,
Katkı veren üstadlara teşekkürler.
Acaba, dosyanızın en son çalışan şeklini ekleyebilir misiniz?