You could use
If Application.CountA(Range("A2:H2,B3:I4,B6:V7,B9:V9,B11:V11,B13:V13,B15:V15")) = 0 Then
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
I have a spreadsheet similar to what is shown below, and I need to use VBA to ensure that none of the data entry cells (blue cells on form) are empty when I go to print the form. I know I can check each cell using If Range(Cell)="" and Range(Cell2)=""... but I would like to know if there is a better way: Maybe check the whole group of cells by naming the entire group of blue cells; Checking entire ranges; Looping through all cell options; Or any another better option.
Thanks, SP
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
You could use
If Application.CountA(Range("A2:H2,B3:I4,B6:V7,B9:V9,B11:V11,B13:V13,B15:V15")) = 0 Then
Oh wait - this will only work if ALL cells are empty. Try
If Application.CountA(Range("I8,R8,AB8,F30:M30,F111,Q111")) < Range("I8,R8,AB8,F30:M30,F111,Q111").Count Then
Thanks again. I just modified your original formula to add <> # of cells, and it's working great.
Really appreciate your help!!