Please help with "simple" code issue

  • Thread starter Thread starter Andrew
  • Start date Start date
A

Andrew

I am trying to get a worksheet (named data) to automatically sort
itself when the workbook opens. It should sort according to column
D. This code has been placed in the workbook code module.

Private Sub workbook_open()
Worksheets("data").Range(Cells(1, 1), Cells(50000, 7)).Sort
Key1:=Worksheets("data").Range("D2")
End Sub

I ran this code about 4 or 5 times, and it worked every time. Then it
stopped working for no apparent reason. I get an error when I run
it. Help please.

thanks.
 
Hello Andrew
What is the exact error?

HTH
Cordially
Pascal

"Andrew" <[email protected]> a écrit dans le message de (e-mail address removed)...

Pascal,
I've run the code twenty times without fail. So I cannot get an
error message for you. Maybe it is healed. Thanks.

Andrew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top