İçerik silince dosyanın küçülmemesi

Katılım
23 Aralık 2004
Mesajlar
39
Merhaba, bir sistemden çekilen excel de 2 sheet 800-900 satır 6 sütun var. Düz yazı ve raklamlar var. Birkaç renklendirme var. Dosya 50mb tutuyor ve yavaş çalışıyor. Sheet'lerden sağdakini silip kaydedince ufalıyor dosya. Neden böyle olabilir? Dosya boyutunu artıran şey ne olabilir?
 

uzmanamele

Uzman
Uzman
Katılım
26 Eylül 2007
Mesajlar
9,421
Excel Vers. ve Dili
excel 2010
Merhaba, bir sistemden çekilen excel de 2 sheet 800-900 satır 6 sütun var. Düz yazı ve raklamlar var. Birkaç renklendirme var. Dosya 50mb tutuyor ve yavaş çalışıyor. Sheet'lerden sağdakini silip kaydedince ufalıyor dosya. Neden böyle olabilir? Dosya boyutunu artıran şey ne olabilir?
Merhaba
Sağdaki dosyayı sildiğinizde dosya boyutu küçülüyor demişsiniz. Soldakini silince küçülmüyor mu?
Burada kriter sağ ve sol değil ki? sayfadaki verinin içeriği.
 

Greenblacksea53

Altın Üye
Katılım
5 Ocak 2019
Mesajlar
569
Excel Vers. ve Dili
Ofis 365 Tr
Altın Üyelik Bitiş Tarihi
05-01-2025
xlsb olarak kaydederseniz dosyanız yarıya yarıya küçülür. Biçimlendirme, Kenarlık, vs vs boyutu artırmasında önemli etkenlerdir.
 
Katılım
20 Şubat 2012
Mesajlar
242
Excel Vers. ve Dili
office2007 Türkçe
Sorun sadece excel boyutu ile alakalı ise dosyayı xlbs olarak kaydederseniz hacmin oldukça küçüldüğünü görebilirsiniz.
Bunun yanıda vba yardımı ile de hacim düşürülebilir. Geçmişte ben aşağıdaki yabancı sitelerden aldığım programı kullanmıştım.
YEDEK alıp sizde deneyebilirsiniz. Yedek almadan denemeyin.
Kod:
Sub SHRINK_EXCEL_FILE_SIZE()
'https://excelitems.com/2010/11/shrink-reduce-excel-file-size.html
    Dim WSheet As Worksheet
    Dim CSheet As String 'New Worksheet
    Dim OSheet As String 'Old WorkSheet
    Dim Col As Long
    Dim ECol As Long 'Last Column
    Dim lRow As Long
    Dim BRow As Long 'Last Row
    Dim Pic As Object
 
    For Each WSheet In Worksheets
        WSheet.Activate
         'Put the sheets in a variable to make it easy to go back and forth
        CSheet = WSheet.Name
         'Rename the sheet to its name with _Delete at the end
        OSheet = CSheet & "_Delete"
        WSheet.Name = OSheet
         'Add a new sheet and call it the original sheets name
        Sheets.Add
        ActiveSheet.Name = CSheet
        Sheets(OSheet).Activate
         'Find the bottom cell of data on each column and find the further row
        For Col = 1 To Columns.Count 'Find the actual last bottom row
            If Cells(Rows.Count, Col).End(xlUp).Row > BRow Then
                BRow = Cells(Rows.Count, Col).End(xlUp).Row
            End If
        Next
      
         'Find the end cell of data on each row that has data and find the furthest one
        For lRow = 1 To BRow 'Find the actual last right column
            If Cells(lRow, Columns.Count).End(xlToLeft).Column > ECol Then
                ECol = Cells(lRow, Columns.Count).End(xlToLeft).Column
            End If
        Next
      
         'Copy the REAL set of data
        Range(Cells(1, 1), Cells(BRow, ECol)).Copy
        Sheets(CSheet).Activate
         'Paste Every Thing
        Range("A1").PasteSpecial xlPasteAll
         'Paste Column Widths
        Range("A1").PasteSpecial xlPasteColumnWidths

        Sheets(OSheet).Activate
        For Each Pic In ActiveSheet.Pictures
            Pic.Copy
            Sheets(CSheet).Paste
            Sheets(CSheet).Pictures(Pic.Index).Top = Pic.Top
            Sheets(CSheet).Pictures(Pic.Index).Left = Pic.Left
        Next Pic
        Sheets(CSheet).Activate
      
         'Reset the variable for the next sheet
        BRow = 0
        ECol = 0
    Next WSheet
 
     ' Since, Excel will automatically replace the sheet references for you on your formulas,
     ' the below part puts them back.
     ' This is done with a simple replace, replacing _Delete with nothing
    For Each WSheet In Worksheets
        WSheet.Activate
        Cells.Replace "_Delete", ""
    Next WSheet
 
    'Roll through the sheets and delete the original fat sheets
    For Each WSheet In Worksheets
        If Not Len(Replace(WSheet.Name, "_Delete", "")) = Len(WSheet.Name) Then
            Application.DisplayAlerts = False
            WSheet.Delete
            Application.DisplayAlerts = True
        End If
    Next
End Sub
Veya

Kod:
Sub ExcelDiet()
    
    Dim j               As Long
    Dim k               As Long
    Dim LastRow         As Long
    Dim LastCol         As Long
    Dim ColFormula      As Range
    Dim RowFormula      As Range
    Dim ColValue        As Range
    Dim RowValue        As Range
    Dim Shp             As Shape
    Dim ws              As Worksheet
    
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    
    On Error Resume Next
    
    For Each ws In Worksheets
        With ws
             'Find the last used cell with a formula and value
             'Search by Columns and Rows
            On Error Resume Next
            Set ColFormula = .Cells.Find(What:="*", After:=Range("A1"), LookIn:=xlFormulas, _
            LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious)
            Set ColValue = .Cells.Find(What:="*", After:=Range("A1"), LookIn:=xlValues, _
            LookAt:=xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlPrevious)
            Set RowFormula = .Cells.Find(What:="*", After:=Range("A1"), LookIn:=xlFormulas, _
            LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
            Set RowValue = .Cells.Find(What:="*", After:=Range("A1"), LookIn:=xlValues, _
            LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
            On Error GoTo 0
            
             'Determine the last column
            If ColFormula Is Nothing Then
                LastCol = 0
            Else
                LastCol = ColFormula.Column
            End If
            If Not ColValue Is Nothing Then
                LastCol = Application.WorksheetFunction.Max(LastCol, ColValue.Column)
            End If
            
             'Determine the last row
            If RowFormula Is Nothing Then
                LastRow = 0
            Else
                LastRow = RowFormula.Row
            End If
            If Not RowValue Is Nothing Then
                LastRow = Application.WorksheetFunction.Max(LastRow, RowValue.Row)
            End If
            
             'Determine if any shapes are beyond the last row and last column
            For Each Shp In .Shapes
                j = 0
                k = 0
                On Error Resume Next
                j = Shp.TopLeftCell.Row
                k = Shp.TopLeftCell.Column
                On Error GoTo 0
                If j > 0 And k > 0 Then
                    Do Until .Cells(j, k).Top > Shp.Top + Shp.Height
                        j = j + 1
                    Loop
                    If j > LastRow Then
                        LastRow = j
                    End If
                    Do Until .Cells(j, k).Left > Shp.Left + Shp.Width
                        k = k + 1
                    Loop
                    If k > LastCol Then
                        LastCol = k
                    End If
                End If
            Next
            
            .Range(.Cells(1, LastCol + 1), .Cells(.Rows.Count, .Columns.Count)).EntireColumn.Delete
            .Range("A" & LastRow + 1 & ":A" & .Rows.Count).EntireRow.Delete
        End With
    Next
    
    Application.ScreenUpdating = True
    Application.DisplayAlerts = True
    
End Sub
 

ÖmerFaruk

Destek Ekibi
Destek Ekibi
Katılım
22 Ekim 2017
Mesajlar
4,779
Excel Vers. ve Dili
Microsoft 365 Tr-64
Sayfa2 de A1 hücresindeyken Ctr+End tuş kombinasyonuyla sayfanın SON HÜCRE sine gidiniz.
Sayfa2 de kullanmadığınız Satır ve Sütunlar varsa buradan belli olacaktır.
Böyle bir durum varsa bu Satır ve Sütunları siler dosyayı bu kaliyle kaydederseniz dosyanız küçülecektir.
XLSB formatı konusunu da bu işlemi yaptıktan sonra hala boyutunuz fazlaysa muhakkak değerlendirin.
 
Üst