Macro Question

J

John

I have a form that I will need co-workers to fill out. I
want to create a button that if pressed will make sure
all the fields are completely filled out? Can a Macro do
that?
 
R

Ron de Bruin

You can use this John

Dim myrange As Range
Set myrange = Worksheets("Sheet1").Range("A1:A6,C10,D12,G1:G3")
If Application.WorksheetFunction.CountA(myrange) < _
myrange.Cells.Count Then
MsgBox "fill in all cells"
Cancel = True
End If
 
R

Ron de Bruin

Hi John

I copy this code from a beforeclose event and forgot to delete this line
Cancel = True

Sorry
 

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