View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] shilparvind@hotmail.com is offline
external usenet poster
 
Posts: 1
Default VBA, Excel Date Problem

Hi,

I am using VBA's inbuilt date function. I am making that date to print
in one of Excel sheet's cells. The problem is date is printed on the
cell as #########. When i click on that cell i can see the correct date
in the formula bar. What is wrong? Below is my code:

Private Sub txtDate_Change()
txtDate = Format(Date, "mm/dd/yy")
Cells(1, 2) = txtDate.Text ' Printing it in the B1 cell
End Sub

I even tried something like this:

Sub Macro1()
Range("B1").NumberFormat = "dddd mmm.d yyyy"
Range("B1").Value = Date
End Sub

In both the cases the answer is ####### in the B1 cell.

Any help on this will be greatly appreciated. I dont know where i am
going wrong.

Regards
Shilpa