How to check the value of a Column

  • Thread starter Thread starter tlee
  • Start date Start date
If all the values in a column are text or all the values in a column are
number, then pick a cell and test it:

Sub WellWhatIsIt()
n = Cells(Rows.Count, "Z").End(xlUp).Row
v = Range("Z" & n)
If Application.WorksheetFunction.IsNumber(v) Then
MsgBox ("numbers")
Else
MsgBox ("text")
End If
End Sub

For column Z
 
Hi Gray,

Thanks for your help.

If I would like to check all the cells in Column D such that D2 to D9999,
how can I code it?

TLee
 
Hi Gray,

Please let me refine my question.

I suppose all cells data in Column D is number. If checked it contains
string(even only one cell), then it shows the message ("text")

Thanks
TLee
 
Back
Top