IsText IsNumber VBA

Pardha Sai Kumar 1 Reputation point
2022-09-22T17:33:19.493+00:00

I get RTE 13 for the below conditions?

UserRange is from Inputbox Type 8

UserXRange{1,2,3,4,5,6,7,8,9,10}
UserYRange{0.2, 0.7, 0.8, 1.1, 2.4, 2.9, 4.7, 6.4, 7.9, 11.3}

If Not WorksheetFunction.IsNonText(UserXRange) = True Or Not WorksheetFunction.IsNonText(UserYRange) = True Then
MsgBox "Range values can't be text"
Exit Sub
End If

If Not WorksheetFunction.IsNumber(UserXRange) = True Or Not WorksheetFunction.IsNumber(UserYRange) = True Then
MsgBox "Range values have to be integer or decimal"
Exit Sub
End If

Developer technologies Visual Basic for Applications
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. John Korchok 6,126 Reputation points
    2022-09-22T19:38:22.22+00:00

    IsNotText expects a variant, but you're sending it an array. Try processing each value in turn using a loop, rather than sending as a group.

    https://learn.microsoft.com/en-us/office/vba/api/excel.worksheetfunction.isnontext

    1 person found this answer helpful.
    0 comments No comments

  2. Pardha Sai Kumar 1 Reputation point
    2022-09-22T19:56:56.747+00:00

    So, loop is the only option.

    I can't use formula in VBA like in excel =SUM(--(ISNUMBER(A1:A10)))

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.