0
votes

I have simple VBA program which requires checking a range and telling user whether there are any empty cells -if so, which cells.

The problem line is this:

Dim outputsrange("inputnum+1:inputnum+outputnum") As range

The function:

Sub check()
'   Goal: check if there are any entry truth table cells for outputs
Dim outputsrange("inputnum+1:inputnum+outputnum") As range
If IsEmpty(outputsrange) Then
    MsgBox ("The following cells are empty:" & vbNewLine & emptycell) ' what's the property for these empty cells
End If
End Sub

This gives error:

Compile error:

Type mismatch

How do I fix this type mismatch?

1
does your compiler tell you which line the mismatch is on? - Noam Hacker

1 Answers

2
votes

You could try something closer to this.

Dim outputsrange As range
Set outputsrange = Range(inputnum + 1 & ":" & inputnum + outputnum)

With inputnum as 1 and outputnum as 5 that should set outputsrange as rows 2 through 6.