Repairs to XLSB workbook

Billdub417

New Member
Joined
Nov 5, 2019
Messages
32
Hello,

Glad of any advice..
I have a workbook with quite a lot of code in....

Sometime when I open it, it is randomly coming up as read only and the below repair...

Any thoughts on why this might be happening and how to stop it going forward?

thanks,


1613404713084.png
 

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,248
Office Version
  1. 365
Platform
  1. Windows
Sounds like you have code that sorts the 3rd sheet in the workbook & that you are not deleting existing sortfields before adding the new ones.
 

Billdub417

New Member
Joined
Nov 5, 2019
Messages
32
Sounds like you have code that sorts the 3rd sheet in the workbook & that you are not deleting existing sortfields before adding the new ones.
When you say the 3rd sheet - does this include hidden sheets?
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,248
Office Version
  1. 365
Platform
  1. Windows
Yes it does.
 

Billdub417

New Member
Joined
Nov 5, 2019
Messages
32

ADVERTISEMENT

Yes it does.
The only thing i can see is a macro that affects this sheet as below:

Would this be causing it? If so, what would needs adding to delete sortfield?

VBA Code:
Sub Update()
With Sheets("sh3")
With .Sort
        .SortFields.Add Key:=Range("A1"), Order:=xlAscending
         .SetRange Sheet1.Range("A1:C1000")
         .Header = xlYes
         .Apply
        End With
End With

End Sub
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,248
Office Version
  1. 365
Platform
  1. Windows
Yup, that's the culprit, add this line as shown
VBA Code:
With .Sort
        .SortFields.Clear
        .SortFields.Add Key:=Range("A1"), Order:=xlAscending
 
Solution

Billdub417

New Member
Joined
Nov 5, 2019
Messages
32
Yup, that's the culprit, add this line as shown
VBA Code:
With .Sort
        .SortFields.Clear
        .SortFields.Add Key:=Range("A1"), Order:=xlAscending
Perfecto! Thanks so much, you wouldn't realise how annoying that has been !!! :D
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,248
Office Version
  1. 365
Platform
  1. Windows
You're welcome & thanks for the feedback.
 

Watch MrExcel Video

Forum statistics

Threads
1,126,978
Messages
5,621,942
Members
415,868
Latest member
Pita

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
Top