Spell Check in userform

kakiebos

Board Regular
Joined
Jun 10, 2018
Messages
62
Hi,

I have a spell check macro for my password protected sheets.
I also have a userform with a few last inputs (in some text boxes) by the user and these are to be sent to the spreadsheet.
This will be the last part of the job card for the user to complete before printing the job card (as PDF)

I have command buttons in the userform.

One for "Cancel" to exit the userform without filling anything in.
Code:
Private Sub btCancel_Click()
  Unload Me
End Sub

One for adding the information to the spreadsheet
Code:
Private Sub btAddl_Click()
'  Code written here. It is working good.
End Sub

I now want to have a comand button to run a spell check in the spreadsheet.
My code for the spell check is:
Code:
Private Sub Spel_Check()


    ActiveSheet.Unprotect ("PassWord")
    Cells.CheckSpelling
    ActiveSheet.Protect ("PassWord")


End Sub

and my code for the spell check command button is
Code:
Private Sub btSpelCheck_Click()
  Call Spel_Check
End Sub
When I click on the spell check button I get the following error.
Compile error:
Sub of Function not defined.

What am I doing wrong?
Please help this self taught excel and VBA user.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
I don't think you can call a Private Sub

Use a Module Script like this:

You can put a Module script in your UserForm.

Code:
Sub Spell_Chek()
ActiveSheet.Unprotect ("PassWord")
    Cells.CheckSpelling
    ActiveSheet.Protect ("PassWord")
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,169
Members
453,021
Latest member
Justyna P

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