Thread: Lost my Paste
View Single Post
  #4   Report Post  
Mike R
 
Posts: n/a
Default

Dave Thanks for the post
Do I put this in via the "tab" "view Code" and paste? If so this is where
the other code is and there seems to be some lines that are the same in the
two codes. "Private Sub Worksheet_SelectionChange(ByVal Target As Range)" is
in the first line of yours and Ron's. it brings a debug error. I know so
little about VBA I don't really know what to do from here. I am learning so
anything you can do to point me in a direction is greatly appreciated.
Thanks again!!


"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