ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Is there a simple way to check lots of cells for entries? (https://www.excelbanter.com/excel-programming/376539-there-simple-way-check-lots-cells-entries.html)

Keith

Is there a simple way to check lots of cells for entries?
 
I have a worksheet that has rows 3 - 23 in input lines for the user. Not all
rows will be used. It depends on how many places the person has visited.

When the person goes to save the file I want to check to see if certain
columns have been filled in. If they have not then I want to open a message
box telling them to fill them in before saving.

My question is this. since not all rows will have entries I only want to
test the rows that have something in any of the columns A - AF

Is there a simple way to check this?

Mike

Is there a simple way to check lots of cells for entries?
 
Try this

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
msg = "You must fill in the sheet before saving"
If Worksheets("sheet5").Range("A3:AF23").Text = "" Then
MsgBox (msg)
End If
End Sub

"Keith" wrote:

I have a worksheet that has rows 3 - 23 in input lines for the user. Not all
rows will be used. It depends on how many places the person has visited.

When the person goes to save the file I want to check to see if certain
columns have been filled in. If they have not then I want to open a message
box telling them to fill them in before saving.

My question is this. since not all rows will have entries I only want to
test the rows that have something in any of the columns A - AF

Is there a simple way to check this?


Keith

Is there a simple way to check lots of cells for entries?
 
Hi Mike,

Unfortunatly this won't work as some fields are required and others are a
case of this option or this option so some cells are mandatory and others are
not.

"Mike" wrote:

Try this

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
msg = "You must fill in the sheet before saving"
If Worksheets("sheet5").Range("A3:AF23").Text = "" Then
MsgBox (msg)
End If
End Sub

"Keith" wrote:

I have a worksheet that has rows 3 - 23 in input lines for the user. Not all
rows will be used. It depends on how many places the person has visited.

When the person goes to save the file I want to check to see if certain
columns have been filled in. If they have not then I want to open a message
box telling them to fill them in before saving.

My question is this. since not all rows will have entries I only want to
test the rows that have something in any of the columns A - AF

Is there a simple way to check this?



All times are GMT +1. The time now is 05:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com