Checking Data Types in a Range
问题 I am trying to validate the data types of all cells in a user-selected range are the same, using a VBA function. I have the following code (simplified), which works for the most part: Dim vTempRange As Variant Dim vCell As Variant vTempRange = DataRange.Value For Each vCell In vTempRange If Len(vCell) > 0 Then 'Use TypeName(vCell) 'Complete validation here End If Next vCell Sometimes a user may select a column of percentages, sometimes a column of decimal values, and sometimes a time value