Un-Sort worhsheet before pulling data.

BMRC

New Member
Joined
Feb 8, 2008
Messages
21
Hi All,

Thanks in advance for any help you can offer.

I am pulling data from a shared woorkbook tool. I am having trouble unsorting the woorkbook data prior to pulling it in.

Activesheet.Show all data works great, but errors out if no data is sorted. Is there somethgin I can do to find out if the data is sorted?

This does not work, but is basically what I am attempting to do..

If Cells.Sort = True Then
ActiveSheet.ShowAllData
Else
End If
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
are you wanting to remove an auto filter rather than "unsort"?

if you want to unfilter, then try:



If Worksheets("Sheet1").AutoFilterMode Then
Worksheets("Sheet1").ShowAllData
End If
 
Upvote 0
Thanks for the reply

It still has the same trouble. It works fine if there is sorted data, but fails if nothing is sorted...

If Worksheets("Orders").AutoFilterMode Then
Worksheets("Orders").ShowAllData
End If
 
Upvote 0
bmrc, you keep mentioning sorted data. can you post a sample of what you are looking at, and then what you want it to be before you copy it over to the new workbook. also, post the full code of what you have so far. remember to use code tags around your macro when posting it to this website. as an example:

Code:
If Worksheets("Orders").AutoFilterMode Then
Worksheets("Orders").ShowAllData
End If

ps try this first:
Code:
If Worksheets("Orders").FilterMode Then
Worksheets("Orders").ShowAllData
End If
 
Last edited:
Upvote 0
Sorry I mean that the data source workbook has AutoFilter turned on. I want to unsort without removing the autofilter.

Your code does exactly what I was looking for. Thanks so much!


Code:
If Worksheets("Orders").FilterMode Then
Worksheets("Orders").ShowAllData
End If
 
Upvote 0
you're welcome. its nice to be able to help someone for a change and put something back into this forum. :o)
 
Upvote 0

Forum statistics

Threads
1,224,588
Messages
6,179,743
Members
452,940
Latest member
rootytrip

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