Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA, Excel Date Problem

Try widening the column.

--
HTH

Bob Phillips

wrote in message
oups.com...
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
date problem in excel arindamkol_1978 Excel Worksheet Functions 4 July 15th 06 08:56 AM
excel date problem Saiju Mammen Excel Worksheet Functions 2 August 15th 05 01:25 PM
date problem in excel Wozniak Excel Discussion (Misc queries) 5 August 6th 05 11:39 AM
Date format problem in Excel Rama Bangaru Excel Programming 3 March 9th 05 09:40 AM
Excel Date/Time problem Demian Valle Excel Programming 1 August 3rd 04 03:09 AM


All times are GMT +1. The time now is 12:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"