View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Steen Steen is offline
external usenet poster
 
Posts: 104
Default Use of Calendar in both a form and excel sheet

Hi NickHK

Thanks for your answer - I havn't had time to try it yet, but will return
with the result during the next week :-)

Where do I declare a global variable - the code is placed in different places?

/Steen

"NickHK" skrev:

Steen,
You need some check of where the calendar was called from. Depending how you
calling it, set a global variable at suitable places then check its value to
determine the destination:
Dim FromWS as boolean

.....
If FromWS = True Then
ActiveCell.Value = Calendar1.Value
Else
frmSelectView.ActiveControl = Calendar1.Value
End If

NickHK

"Steen" wrote in message
...
Hi Alok

Thanks for your feedback, but unfurtuanately it does not solve my problem.

If I use the below the dates will be set for both the userform and the
tasklist (deadline) at the same time. I wood like it to be independent -
graph dates has there own dates and Deadlines in the tasklist there own
deadlines.

Can you help me out here?

/Steen

"Alok" wrote:

This works for me

Private Sub Calendar1_Click()
ActiveCell.Value = Calendar1.Value
frmSelectView.ActiveControl = Calendar1.Value
End Sub

Alok

"Steen" wrote:

Hi

I am trying to use the Calendar in both a form selecting start and end

dates
for grapical presentation of data and on a tasklist (excelsheet) all

in the
same wordbook. My problem is that I can't figure out to use it in both

ways -
se my code below:

Private Sub Calendar1_Click()
'frmSelectView.ActiveControl.Value = Calendar1.Value
'frmSelectView.ActiveControl.SetFocus
ActiveCell.Value = Calendar1.Value
'ActiveCell.SetFocus
Unload Me
End Sub

At setup above it works nicely inserting dates in tasklist. If I

uncomment
the other lines and deactivate the current active line - it works

nicely
inserting dates in the userform. How to both?