- Katılım
- 22 Eylül 2019
- Mesajlar
- 231
- Excel Vers. ve Dili
- professional plus 2016-türkçe
DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub Hücrebirleştir()
Dim s1 As Worksheet: Dim i As Integer
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set s1 = Sheets("Sayfa1")
For i = s1.Cells(65535, "A").End(3).Row To 2 Step -1
If s1.Range("D" & i) = s1.Range("D" & i - 1) Then
s1.Range(s1.Cells(i, 4), s1.Cells(i - 1, 4)).MergeCells = True
s1.Cells(i, 4).HorizontalAlignment = xlCenter
s1.Cells(i, 4).VerticalAlignment = xlCenter
If s1.Range("F" & i - 1) = "" Then
s1.Range(s1.Cells(i, 6), s1.Cells(i - 1, 6)).MergeCells = True
s1.Cells(i, 6).HorizontalAlignment = xlCenter
s1.Cells(i, 6).VerticalAlignment = xlCenter
End If
End If
Next i
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Sub Hücrebirleştir()
Dim s1 As Worksheet: Dim i As Integer
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set s1 = Sheets("Sayfa1")
For i = s1.Cells(65535, "A").End(3).Row To 2 Step -1
If s1.Range("D" & i + 1) <> s1.Range("D" & i) And s1.Range("D" & i).MergeCells = False Then
s1.Range("A" & i & ":" & "F" & i).Borders(xlEdgeBottom).Weight = xlMedium
End If
If s1.Range("D" & i) = s1.Range("D" & i - 1) Then
s1.Range(s1.Cells(i, 4), s1.Cells(i - 1, 4)).MergeCells = True
s1.Cells(i, 4).HorizontalAlignment = xlCenter
s1.Cells(i, 4).VerticalAlignment = xlCenter
End If
If s1.Range("F" & i - 1) = "" Then
s1.Range(s1.Cells(i, 6), s1.Cells(i - 1, 6)).MergeCells = True
s1.Cells(i, 6).HorizontalAlignment = xlCenter
s1.Cells(i, 6).VerticalAlignment = xlCenter
End If
Next i
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub