View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Pass date to cell in spreadsheet

Hi Cedtech31,

Try:

With frmWorkHistory
CellPosition.Value = DateSerial(.txtStartYear.Value, _
Me.txtStartMonth, 31)
End With


---
Regards,
Norman



"cedtech23" wrote in
message ...

I changed the code to


Code:
--------------------


Function StartDate()
counter = 1
Set CellPosition = Range("C13")
Do While counter <= 10

If CellPosition.Value = "" Then
CellPosition.Value = CDate(frmWorkHistory.txtStartMonth.Value & "/1/" &
frmWorkHistory.txtStartYear.Value)
MsgBox CellPosition.Value
Exit Do
Else
Set CellPosition = CellPosition.Offset(1, 0)
counter = counter + 1
End If
Loop
End Function

--------------------



it works but if I change "/1/" to "/31/" get "Run Time error '13' type
mismatch"


I don't understand why "/1/" works and "/31" does not??


--
cedtech23
------------------------------------------------------------------------
cedtech23's Profile:
http://www.excelforum.com/member.php...o&userid=31022
View this thread: http://www.excelforum.com/showthread...hreadid=507527