Excel Making a cell Mandatory

Joined
May 9, 2017
Messages
6
Reaction score
1
Good day everyone.

I need a bit of help with something. I have created an excel document where I want to make a cell mandatory to be filled. No take backs. The cells must have something in it. I found the following code that seemed like it would work:

If Cells(1, 2).Value = "" Then
MsgBox "Cell B1 requires user input", vbInformation, "Kutools for Excel"
Cancel = True
End If

(Not my own code.)

However, the cells that must be filled in, are merged. I am completely new at all this coding in Excel. I know bugger all, so please go easy on me with the explanation, haha. Any help at all would be much appreciated. Please advise if you want to know anything else
 

Becky

Webmistress
Joined
Mar 25, 2003
Messages
7,424
Reaction score
1,511
If the cells are merged, I think you only need to make reference to the top left cell. I don't know a great deal about VBA, mind!
 
Joined
May 9, 2017
Messages
6
Reaction score
1
Okay, another issue, sorry. I have it set that the person must fill in the fields before they are allowed to close. However, when thy try to save, a dialogue box comes up saying that they must save it as a macro enabled document in order to be able to save the document and all its changes. Nevermind closing the documents.
Is there any easier way to force a person to fill in a field in excel, without any issues of them saving the document?
 

Becky

Webmistress
Joined
Mar 25, 2003
Messages
7,424
Reaction score
1,511
Unfortunately, as far as I know it's not possible to force a user to fill in a cell using Data Validation - that's why you have to use VBA. You could play around with Data Validation just in case though - you could always start the template with data in the cell (eg. "Enter text here") and make sure that once they have selected the cell they can't leave it blank. Might work. Alternatively you could have a drop down list usig DV, although I don't know whether that would suit your needs.
 
Joined
May 9, 2017
Messages
6
Reaction score
1
Unfortunately, as far as I know it's not possible to force a user to fill in a cell using Data Validation - that's why you have to use VBA. You could play around with Data Validation just in case though - you could always start the template with data in the cell (eg. "Enter text here") and make sure that once they have selected the cell they can't leave it blank. Might work. Alternatively you could have a drop down list usig DV, although I don't know whether that would suit your needs.
Forcing the person to fill in the data once they have clicked on the cell sounds like a good start. How do you do that? I assume it is VBA?
 

Becky

Webmistress
Joined
Mar 25, 2003
Messages
7,424
Reaction score
1,511
Nope, it doesn't involve VBA. Click on the cell, and on the Data tab select Data Validation. You can then select how you want data to be input - including things such as lists. Whatever you choose, if you then go to the Error Alert tab, you can select a Stop-style error, which will mean the user has no choice but to enter appropriate data (eg from a list if that's what you choose) and it will not let them navigate away unless they enter it. Have a play around with it and see what you think :)
 
Joined
May 9, 2017
Messages
6
Reaction score
1
Nope, it doesn't involve VBA. Click on the cell, and on the Data tab select Data Validation. You can then select how you want data to be input - including things such as lists. Whatever you choose, if you then go to the Error Alert tab, you can select a Stop-style error, which will mean the user has no choice but to enter appropriate data (eg from a list if that's what you choose) and it will not let them navigate away unless they enter it. Have a play around with it and see what you think :)
Unfortunately not what I need. Thanks for the help though!
 

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

Top