VBA Sorting Error

S

Scott Halper

I have a file that I want the user to click an insert button and not
be able to insert rows. I have protected the sheet, except for the
area they can enter data into and have created another Sort button.
My code keeps errors at the sort stage. Any help is appreciated.

Private Sub NFP_Sort_Click()
Const PWORD As String = "123456"
Application.ScreenUpdating = False
With Worksheets("Southeast - NFP")
.Select
.Unprotect Password:=PWORD
.Range("NFP_Sort").Select
.Sort Key1:=Range("Q7"), Order1:=xlDescending,
Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom,
_
DataOption1:=xlSortNormal
.Range("Total_NFP").Select
.Protect Password:=PWORD
End With
Application.ScreenUpdating = False
End Sub

Thanks,
Scott
 
J

Jim Cone

See your other posts and please read this...
http://www.cpearson.com/excel/newposte.htm
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)


"Scott Halper"
wrote in message
I have a file that I want the user to click an insert button and not
be able to insert rows. I have protected the sheet, except for the
area they can enter data into and have created another Sort button.
My code keeps errors at the sort stage. Any help is appreciated.
-snip-
Thanks,
Scott
 

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

Similar Threads

Excel VBA Sorting Error 4
Error with sorting 2
help with input box 1
Sorting 1
Inserting a row 1
sort macro not working 1
Change range from cells to sheet? 1
Why is a descending sort putting blank cells first? 5

Top