FAO: Dave Peterson - Re: Fill Colour in Locked Sheet!!

  • Thread starter Thread starter Jado
  • Start date Start date
J

Jado

Hi Dave

i ran what i needed and got the following error: 'Show method of Dialog
class failed'

Any Ideas why??

Thanks Jado

---------------------------------------------


How about letting them select a range (you could check to make sure it's ok
with
you in code), then show the dialog, then fill the cells.

Option Explicit
Sub testme()

Dim myRng As Range

With ActiveSheet
'a specific cell
Set myRng = .Range("a1")
'for just the first cell in the selection
Set myRng = Selection(1)
'for all the selected cells
Set myRng = Selection

.Unprotect Password:="hi"
Application.Dialogs(xlDialogPatterns).Show
.Protect Password:="hi"

End With

End Sub
 
It worked for me in xl2002.

If you get rid of all the extraneous stuff and just run this little portion

Option Explicit
Sub testme()
Application.Dialogs(xlDialogPatterns).Show
End Sub

against a brand new (unprotected worksheet), does it work?

I could get (different) error messages if my worksheet were protected (and I
didn't unprotect it correctly) or if I ran it against a sheet that wasn't a
worksheet (like a chartsheet).

If you try it and it still doesn't work, post back with your version of excel.

Maybe someone who is running the same version can test it for us.
 
Hi Dave

i've tried the code on a different pc and it works fine :)

Thanks for the code, you've save me a lot of time creating a form with lots
of different coloured buttons.

Thanks again

Jado
 
If you find out what caused the error on the first pc, post back.

(I'm still at a loss.)
Hi Dave

i've tried the code on a different pc and it works fine :)

Thanks for the code, you've save me a lot of time creating a form with lots
of different coloured buttons.

Thanks again

Jado
 
Back
Top