How define that cell contain date (number) with VBA?

Useful

Active Member
Joined
Mar 16, 2011
Messages
494
Hi mr excel
in column A contains date and text - in this case i know that it is possible to define this with function - isnumber() but wich VBA function i have to use in that case?
(P.S: in VBA only i know isempty() function)
Thanks!
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
The equivalent of isnumber in VBA is IsNumeric()
 
Upvote 0
Code:
The equivalent of isnumber in VBA is IsNumeric()
Not exactly.

IsNumeric("123") returns True.

VarType(Range("A1").Value2) = vbDouble will tell you if a cell contains a number.

VarType(Range("A1").Value) = vbDate will tell you if it contains a number formatted as a date.
 
Upvote 0
Code:
The equivalent of isnumber in VBA is IsNumeric()
Not exactly.

IsNumeric("123") returns True.

VarType(Range("A1").Value2) = vbDouble will tell you if a cell contains a number.

VarType(Range("A1").Value) = vbDate will tell you if it contains a number formatted as a date.

Hi dear friend SHG of course thanks for your advice that is good idea too
also i can use this code that defines is cell contain date or number returns true
Code:
If isnumeric(Range("A5").DataSeries) Then

Shg i really appreciate your advice thanks for everybody
 
Upvote 0

Forum statistics

Threads
1,224,544
Messages
6,179,430
Members
452,915
Latest member
hannnahheileen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top