View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Kevin Vaughn Kevin Vaughn is offline
external usenet poster
 
Posts: 111
Default Pretty easy If loop - help!!

It looks like you are trying to get the first character of a date. What if
the month is January, October, November, or December? How would you know
which it is? Why not use something like month(activecell.value)
--
Kevin Vaughn


"nemadrias" wrote:

How can I use an if loop to return the first number of a date.

For example, if cell A1 has the date: 7/06/2006, I want to say:

If (ActiveCell.Characters(Start:=1, Length:=1).Text = "7") Then
TodayInt = 7
End If

But this is trying to look for a string and its finding a date, so I
get an error...Anyone have a better idea??