Calendar Control/Freezepane Conflict

mezr

Active Member
Joined
Feb 2, 2003
Messages
301
Hi,

I started using this code to bring up a calendar control that would allow me to double click a date on the calendar and place that date in the active cell.
Code:
Private Sub Calendar1_DblClick()
    ActiveCell.NumberFormat = "mm/dd/yy"
    ActiveCell = Calendar1
    Calendar1.Visible = False   
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
     If Not Intersect(Target, [D6:D22,H6:H22]) Is Nothing Then
            Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
            Calendar1.Top = Target.Top + Target.Height
            Calendar1.Visible = True
         Else: Calendar1.Visible = False
    End If
End Sub
I've run into an unusual problem with it though. That is, I am using a freezepane set at cell C6, and frequently when the calendar pops up it won't respond. What I've noticed though is that when I turn off the freezepane, everything works fine.

Since the freezepane is necessary, are there any suggestions for how I can write this code differently, maybe how I can turn off the freezepane at the start of the code and have it reset to cell C6 at the end - without actually moving the screen to C6?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Mezr, since no one has responded to your question, I'd like to suggest a possible fix.

Create a macro to unfreeze and then refreeze your cell c6 freezpane.
Now, go into the Macro, Edit, and get the VB code that is used for this, and try it out in your VB code. Hope this helps you solve your problem! :)
 
Upvote 0

Forum statistics

Threads
1,214,870
Messages
6,122,021
Members
449,060
Latest member
LinusJE

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top