Worksheet vertical scrollbar too long

PATSYS

Well-known Member
Joined
Mar 12, 2006
Messages
1,750
Hi all,

I have this file (with one worksheet in it) created in excel 2003.

I am now using excel 2007 and this worksheet only has data up to 903 rows. However the veritical scroll is too long.

I tried going to row 904, CTRL+SHIFT+END then delete entire row. After saving, it is still the same, scrollbar still too long.

Another weird about this worksheet it is that it has up to column XFD, but row is only up to 65536. So I am confused if this is excel 2003 worksheet or 2007.

Lastly, everytime I delete a column, the new column that comes out from the end (XFD) automatically gets a shade.

Anybody experienced this?
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try running this
Code:
Sub DeleteUnused()
Dim myLastRow As Long
Dim myLastCol As Long
Dim wks As Worksheet
Dim dummyRng As Range

For Each wks In ActiveWorkbook.Worksheets
  With wks
    myLastRow = 0
    myLastCol = 0
    Set dummyRng = .UsedRange
    On Error Resume Next
    myLastRow = _
      .Cells.Find("*", after:=.Cells(1), _
        LookIn:=xlFormulas, LookAt:=xlWhole, _
        SearchDirection:=xlPrevious, _
        SearchOrder:=xlByRows).Row
    myLastCol = _
      .Cells.Find("*", after:=.Cells(1), _
        LookIn:=xlFormulas, LookAt:=xlWhole, _
        SearchDirection:=xlPrevious, _
        SearchOrder:=xlByColumns).Column
    On Error GoTo 0

    If myLastRow * myLastCol = 0 Then
        .Columns.Delete
    Else
        .Range(.Cells(myLastRow + 1, 1), _
          .Cells(.Rows.Count, 1)).EntireRow.Delete
        .Range(.Cells(1, myLastCol + 1), _
          .Cells(1, .Columns.Count)).EntireColumn.Delete
    End If
  End With
Next wks
End Sub
 
Upvote 0
My first thought was copy the data into a new workbook - and cross fingers. You'd want to copy only the used range of cells with data, not the entire sheet, and if possible as little of the information as needed to preserve the fundamental data you need. If it's just some wierd bytes stuck somewhere maybe you'll shake it off. Also get out of compatibility mode if you can.
 
Upvote 0
Try running this
Code:
Sub DeleteUnused()
Dim myLastRow As Long
Dim myLastCol As Long
Dim wks As Worksheet
Dim dummyRng As Range

For Each wks In ActiveWorkbook.Worksheets
  With wks
    myLastRow = 0
    myLastCol = 0
    Set dummyRng = .UsedRange
    On Error Resume Next
    myLastRow = _
      .Cells.Find("*", after:=.Cells(1), _
        LookIn:=xlFormulas, LookAt:=xlWhole, _
        SearchDirection:=xlPrevious, _
        SearchOrder:=xlByRows).Row
    myLastCol = _
      .Cells.Find("*", after:=.Cells(1), _
        LookIn:=xlFormulas, LookAt:=xlWhole, _
        SearchDirection:=xlPrevious, _
        SearchOrder:=xlByColumns).Column
    On Error GoTo 0

    If myLastRow * myLastCol = 0 Then
        .Columns.Delete
    Else
        .Range(.Cells(myLastRow + 1, 1), _
          .Cells(.Rows.Count, 1)).EntireRow.Delete
        .Range(.Cells(1, myLastCol + 1), _
          .Cells(1, .Columns.Count)).EntireColumn.Delete
    End If
  End With
Next wks
End Sub

Hi pboltonchina,

Thanks for the codes but that didn't solve it.
 
Upvote 0
My first thought was copy the data into a new workbook - and cross fingers. You'd want to copy only the used range of cells with data, not the entire sheet, and if possible as little of the information as needed to preserve the fundamental data you need. If it's just some wierd bytes stuck somewhere maybe you'll shake it off. Also get out of compatibility mode if you can.

Hi Xenou,

That did it. I just copied to a new sheet.

It must have something to do with this compatibility mode.

Thanks
 
Upvote 0

Forum statistics

Threads
1,224,584
Messages
6,179,693
Members
452,938
Latest member
babeneker

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top