View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 292
Default Date from DTPicker

Can it be as simple as you've forgotten to say which cell fcell is ? This
works fine he

Sub test()

Dim subven(5, 2) As Variant
subven(1, 2) = DateSerial(2005, 12, 25) ' DTPicker1.Value

Dim fcell As Range
Set fcell = Sheets(1).Range("B2")
fcell.Value = subven(1, 2)
End Sub

If you put
Option Explicit
on top of your modules, then then VB editor will provide helpful error
messages in cases like this.

HTH. Best wishes Harald



"ranswrt" skrev i melding
...
I am trying to take the date from value of a DTpicker and put it into a
cell
on a worksheet. When I do this I get the wrong date in the cell. For
example I take the date from DTPicker by using the following code:

dim subven(5,2) as variant
subven(1, 2) = DTPicker1.Value

and I put it into a cell by using

dim fcell as range
fcell=subven(1,2)

I get the wrong date in fcell. The date in fcell is always 1/0/1900. I
tried doing different number date formats in fcell and I get the same
results. I would like fcell to be in mm/dd/yy format if possible.

How do I get this to work?
Thanks