Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Chisisi Massri   on Mar 10 In MS Office Category.

  
Question Answered By: Hubayshah Mansour   on Mar 10

Hopefully your problem was with the sheet protection. But I'd already
written this message, so, just in case. ...

I have just tried this code

Option Explicit

Private Sub CommandButton1_Click()
Dim w As Worksheet
Set w = ThisWorkbook.Worksheets("Sheet1")

'If cbSortMonth.Value = "(ALL)" And obOrder = True And cbOrder.Value =
"Ascending" Then
w.Rows("8:50").Sort key1:=w.Range("AL8"), Order1:=xlAscending
'End If

End Sub

which is pretty much a copy of yours, but with the IF statement commented
out.

It runs fine.

Which line does yours error  on in the code  you now have? And what
specifically is the run-time error now?

I wonder if it is the IF statement that is failing. Do you have Option
Explicit in your code? If not, please put it in and try it again.

What specific structures are cbSortMonth, obOrder and cbOrder? CB would
normally be a check box, but that doesn't look right here. OB? It's not a
typo is it?

Share: