Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default ActiveCell.Value changes with Format?

Hello There,

I have a cell (containing formula: =D1)
which is formatted as follows:

ddd dd-mmm-jj;;"<Double Click Me"

Upon launching a userform with a calendar it picks up the cell's value
or else takes current day.
Eventhough D1 = empty, my calendar shows me always: 5 march 2002, which
is value =37320

Private Sub UserForm_Initialize()
' Check if active cell contains a date. If 'yes' show
' same date on calendar. If 'no' show today's date.
If IsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date
End If
End Sub

Anyone to overcome this?
Cheers Sige

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default ActiveCell.Value changes with Format?

Hi Sige,

I have been unable to replicate your experience.

To test, I set the userform to open modelessly and added your initialize
code to a button: in this way I could select any cell and test the calendar
response by clicking the button.

However, with (or without) the buton, I had no problem

If you create a new workbook, add a userform (with a calendar control) and
minimal worksheet data, can you reproduce the problem?


---
Regards,
Norman



"Sige" wrote in message
oups.com...
Hello There,

I have a cell (containing formula: =D1)
which is formatted as follows:

ddd dd-mmm-jj;;"<Double Click Me"

Upon launching a userform with a calendar it picks up the cell's value
or else takes current day.
Eventhough D1 = empty, my calendar shows me always: 5 march 2002, which
is value =37320

Private Sub UserForm_Initialize()
' Check if active cell contains a date. If 'yes' show
' same date on calendar. If 'no' show today's date.
If IsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date
End If
End Sub

Anyone to overcome this?
Cheers Sige



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default ActiveCell.Value changes with Format?

Hi Norman,

If you create a new workbook, add a userform (with a calendar control) and
minimal worksheet data, can you reproduce the problem?


Nope... recreated a new wbk & userform ....works fine!
Hmmm, where is the catch this time again?
Sige

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default ActiveCell.Value changes with Format?

Norman,
I was too fast ... I did reproduce it ...as said..blank wbk,blank
userform with new calender control.
Upon creation of this calender control the "highlighted day is today.

BUT if you select another day on this control (during creation of the
userform) then this day will be shown ... while launching the userform
on my "specially formatted cell"
(in my case it was 5 march 2002.)

Thta's already that...,
Sige

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default ActiveCell.Value changes with Format?

Hi Sige,

Try:

Private Sub UserForm_Initialize()
Calendar1.Value = Date
If IsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date
End If
End Sub


---
Regards,
Norman



"Sige" wrote in message
oups.com...
Norman,
I was too fast ... I did reproduce it ...as said..blank wbk,blank
userform with new calender control.
Upon creation of this calender control the "highlighted day is today.

BUT if you select another day on this control (during creation of the
userform) then this day will be shown ... while launching the userform
on my "specially formatted cell"
(in my case it was 5 march 2002.)

Thta's already that...,
Sige





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default ActiveCell.Value changes with Format?

:o)

That's it! Thx again.

- Norman, I do not dare to ask ... would you like to give a look at:
Copy Locked Cell Status?
(Is "Outlining with condition" a possible card?)

:o))) Sige

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
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
activecell slikity Excel Programming 7 December 13th 04 11:59 AM
use of activecell inquirer Excel Programming 8 May 16th 04 06:39 AM
Activecell value Shamsul Islam Excel Programming 5 April 30th 04 10:10 PM
how to set activecell? ljb[_2_] Excel Programming 2 November 18th 03 04:49 PM


All times are GMT +1. The time now is 03:48 PM.

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"