View Single Post
  #2   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 Cedtech23,

Try:

CellPosition.Value = CDate(frmWorkHistory.txtStartMonth.Value _
& "/31/" & frmWorkHistory.txtStartYear.Value)


---
Regards,
Norman



"cedtech23" wrote
in message ...

The following code


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

CellPosition.Value = frmWorkHistory.txtStartMonth.Value) & "/31/" &
frmWorkHistory.txtStartYear.Value

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


passes the value in text boxes txtStartMonth and StartYear to a cell in
my spreadsheet

I thought since the cell is formatted as date that the value in
CellPosition.Value would display as a date but it's not

can I use DateValue?? how can I pass a date to the cell in the spread
sheet?





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

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

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

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


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