DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
Altın Üyelik Hakkında Bilgi
Sub aveb()
If ActiveSheet.Shapes("Düğme 1").TextFrame.Characters.Text = "Ayır" Then
[H4:H7,H8:H11,H12:H15].UnMerge
ActiveSheet.Shapes("Düğme 1").TextFrame.Characters.Text = "Birleştir"
Else
ActiveSheet.Shapes("Düğme 1").TextFrame.Characters.Text = "Birleştir"
[H4:H7,H8:H11,H12:H15].Merge
ActiveSheet.Shapes("Düğme 1").TextFrame.Characters.Text = "Ayır"
End If
End Sub
Sub birlestir()
Application.DisplayAlerts = False
bas = 4
For i = 4 To Cells(Rows.Count, 2).End(3).Row
If Cells(i, 3).MergeCells Then Exit Sub
If Cells(i, 3) = Cells(i + 1, 3) Then
son = i + 1
Else
With Range(Cells(bas, 3), Cells(son, 3))
.Merge
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
bas = i + 1
End With
End If
Next i
Application.DisplayAlerts = True
End Sub
Sub coz()
With Range("C4:C" & Cells(Rows.Count, 2).End(3).Row)
.MergeCells = False
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
.Value = .Value
.Borders.LineStyle = xlContinuous
End With
End Sub
Kod:Sub birlestir() Application.DisplayAlerts = False bas = 4 For i = 4 To Cells(Rows.Count, 2).End(3).Row If Cells(i, 3).MergeCells Then Exit Sub If Cells(i, 3) = Cells(i + 1, 3) Then son = i + 1 Else With Range(Cells(bas, 3), Cells(son, 3)) .Merge .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter bas = i + 1 End With End If Next i Application.DisplayAlerts = True End Sub Sub coz() With Range("C4:C" & Cells(Rows.Count, 2).End(3).Row) .MergeCells = False .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C" .Value = .Value .Borders.LineStyle = xlContinuous End With End Sub
Veyselemre hocam, teşekkürler. İstediğim böyle bir şeydi.
Sub birlestir()
Application.DisplayAlerts = False
bas = 4
For i = 4 To Cells(Rows.Count, 3).End(3).Row
If Cells(i, 3).MergeCells Then Exit Sub
If Cells(i, 3) = Cells(i + 1, 3) Then
son = i + 1
Else
If son > bas Then
With Range(Cells(bas, 3), Cells(son, 3))
.Merge
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
bas = i + 1
End With
End If
End If
Next i
Application.DisplayAlerts = True
End Sub
Sub coz()
Set sonHuc = Cells(Rows.Count, 3).End(3)
sonSat = sonHuc.Row
If sonHuc.MergeCells Then sonSat = sonSat + sonHuc.MergeArea.Rows.Count - 1
For i = 4 To sonSat - 1
If Cells(i, 3).MergeCells Then GoTo cozum
Next i
Exit Sub
cozum:
With Range("C4:C" & sonSat)
.UnMerge
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
.Value = .Value
.Borders.LineStyle = xlContinuous
End With
End Sub
Sub birlestirCoz()
If ActiveSheet.Shapes("Düğme 1").TextFrame.Characters.Text = "Ayır" Then
Set sonHuc = Cells(Rows.Count, 3).End(3)
sonSat = sonHuc.Row
If sonHuc.MergeCells Then sonSat = sonSat + sonHuc.MergeArea.Rows.Count - 1
For i = 4 To sonSat - 1
If Cells(i, 3).MergeCells Then GoTo cozum
Next i
Exit Sub
cozum:
With Range("C4:C" & sonSat)
.UnMerge
.SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C"
.Value = .Value
.Borders.LineStyle = xlContinuous
End With
ActiveSheet.Shapes("Düğme 1").TextFrame.Characters.Text = "Birleştir"
Else
Application.DisplayAlerts = False
bas = 4
For i = 4 To Cells(Rows.Count, 3).End(3).Row
If Cells(i, 3).MergeCells Then Exit Sub
If Cells(i, 3) = Cells(i + 1, 3) Then
son = i + 1
Else
If son > bas Then
With Range(Cells(bas, 3), Cells(son, 3))
.Merge
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
bas = i + 1
End With
End If
End If
Next i
Application.DisplayAlerts = True
ActiveSheet.Shapes("Düğme 1").TextFrame.Characters.Text = "Ayır"
End If
End Sub
Kod:Sub birlestir() Application.DisplayAlerts = False bas = 4 For i = 4 To Cells(Rows.Count, 3).End(3).Row If Cells(i, 3).MergeCells Then Exit Sub If Cells(i, 3) = Cells(i + 1, 3) Then son = i + 1 Else If son > bas Then With Range(Cells(bas, 3), Cells(son, 3)) .Merge .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter bas = i + 1 End With End If End If Next i Application.DisplayAlerts = True End Sub Sub coz() Set sonHuc = Cells(Rows.Count, 3).End(3) sonSat = sonHuc.Row If sonHuc.MergeCells Then sonSat = sonSat + sonHuc.MergeArea.Rows.Count - 1 For i = 4 To sonSat - 1 If Cells(i, 3).MergeCells Then GoTo cozum Next i Exit Sub cozum: With Range("C4:C" & sonSat) .UnMerge .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C" .Value = .Value .Borders.LineStyle = xlContinuous End With End Sub
Kod:Sub birlestirCoz() If ActiveSheet.Shapes("Düğme 1").TextFrame.Characters.Text = "Ayır" Then Set sonHuc = Cells(Rows.Count, 3).End(3) sonSat = sonHuc.Row If sonHuc.MergeCells Then sonSat = sonSat + sonHuc.MergeArea.Rows.Count - 1 For i = 4 To sonSat - 1 If Cells(i, 3).MergeCells Then GoTo cozum Next i Exit Sub cozum: With Range("C4:C" & sonSat) .UnMerge .SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "=R[-1]C" .Value = .Value .Borders.LineStyle = xlContinuous End With ActiveSheet.Shapes("Düğme 1").TextFrame.Characters.Text = "Birleştir" Else Application.DisplayAlerts = False bas = 4 For i = 4 To Cells(Rows.Count, 3).End(3).Row If Cells(i, 3).MergeCells Then Exit Sub If Cells(i, 3) = Cells(i + 1, 3) Then son = i + 1 Else If son > bas Then With Range(Cells(bas, 3), Cells(son, 3)) .Merge .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter bas = i + 1 End With End If End If Next i Application.DisplayAlerts = True ActiveSheet.Shapes("Düğme 1").TextFrame.Characters.Text = "Ayır" End If End Sub