Thread: Lost my Paste
View Single Post
  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default

I meant to use debug.print instead of msgboxes, but I bet either will help.

Dave Peterson wrote:

You can find out by adding some debug statements in your code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
msgbox "1--" & application.cutcopymode
If Target.Cells.Count 1 Then Exit Sub
If Not Application.Intersect(Range("C6"), Target) Is Nothing Then
msgbox "2--" & application.cutcopymode
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
msgbox "3--" & application.cutcopymode
Calendar1.Top = Target.Top + Target.Height
msgbox "4--" & application.cutcopymode
Calendar1.Visible = True
msgbox "5--" & application.cutcopymode
' select Today's date in the Calendar
Calendar1.Value = Date
msgbox "6--" & application.cutcopymode
Else
Calendar1.Visible = False
msgbox "7--" & application.cutcopymode
End If
msgbox "8--" & application.cutcopymode
End Sub

Copy something and then change your selection to see when .cutcopymode changes.

Mike R wrote:

I have some code from Ron deBruin that is used with a calander to select a
date for an active cell. The code works great, but I loose my paste
function. I narrowed it down to this code by removing all code one at a time
until I found the one that was denying me the ability to Paste. What part of
this code is removing my Paste function? And how can I keep the function and
the code?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Not Application.Intersect(Range("C6"), Target) Is Nothing Then
Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
Calendar1.Top = Target.Top + Target.Height
Calendar1.Visible = True
' select Today's date in the Calendar
Calendar1.Value = Date
Else: Calendar1.Visible = False
End If
End Sub


--

Dave Peterson


--

Dave Peterson