- Katılım
- 10 Aralık 2019
- Mesajlar
- 92
- Excel Vers. ve Dili
- Ofiice 365
- Altın Üyelik Bitiş Tarihi
- 24-01-2023
Üstatlar aşağı şekilde kodu var bunu nasıl kısaltabilirim?
Kod:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
Dim block1 As Range
Dim block2 As Range
Worksheets("AKADEMIK").Cells.ClearOutline
Worksheets("IDARI").Cells.ClearOutline
Set block1 = Sheets("AKADEMIK").Range("b5:b300")
Set block2 = Sheets("IDARI").Range("b5:b300")
For Each c In block1
If Left(c.Value, 1) = " " Then
c.EntireRow.Group
End If
Next c
For Each c In block1
If Left(c.Value, 2) = " " Then
c.EntireRow.Group
End If
Next c
For Each c In block2
If Left(c.Value, 1) = " " Then
c.EntireRow.Group
End If
Next c
For Each c In block2
If Left(c.Value, 2) = " " Then
c.EntireRow.Group
End If
Next c
Worksheets("AKADEMIK").Outline.ShowLevels RowLevels:=1
Worksheets("IDARI").Outline.ShowLevels RowLevels:=1
End Sub