+ Reply to Thread
Results 1 to 15 of 15

Lost my Paste

  1. #1
    Mike R
    Guest

    Lost my Paste

    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


  2. #2
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    As an aside, I, too, am using this feature and experience the same phenomenon. You can click and drag to copy down/over, but cut/copy>paste does not work.

    I admit it is somewhat annoying, however, I have chosen to accept this inconvenience in my application as a trade-off for the functionality of the macro. It could, I imagine, be unacceptable to larger, more complex apps than mine.
    Bruce
    The older I get, the better I used to be.
    USA

  3. #3
    Dave Peterson
    Guest

    Re: Lost my Paste

    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

  4. #4
    Dave Peterson
    Guest

    Re: Lost my Paste

    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

  5. #5
    Mike R
    Guest

    Re: Lost my Paste

    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
    >


  6. #6
    Debra Dalgleish
    Guest

    Re: Lost my Paste

    I'm not Dave, but Dave's code should replace Ron's code -- you can only
    have one SelectionChange procedure per worksheet module.

    When you select a different cell, it will trigger the SelectionChange
    event, and the code will run. You'll see the messages in the code. The
    number in the last message displayed will tell you where the code
    stopped working.

    Mike R wrote:
    > 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
    >>

    >



    --
    Debra Dalgleish
    Excel FAQ, Tips & Book List
    http://www.contextures.com/tiptech.html


  7. #7
    Mike R
    Guest

    Re: Lost my Paste

    Debra Thank you for the post
    Makes sense that there can only be one SelectionChange procedure per sheet.
    But If I replace Ron's code with Dave's I will have my pase back because
    Ron's code is gone. If I just remove Ron"s code I have paste. Am I not
    fully understanding something?

    "Debra Dalgleish" wrote:

    > I'm not Dave, but Dave's code should replace Ron's code -- you can only
    > have one SelectionChange procedure per worksheet module.
    >
    > When you select a different cell, it will trigger the SelectionChange
    > event, and the code will run. You'll see the messages in the code. The
    > number in the last message displayed will tell you where the code
    > stopped working.
    >
    > Mike R wrote:
    > > 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
    > >>

    > >

    >
    >
    > --
    > Debra Dalgleish
    > Excel FAQ, Tips & Book List
    > http://www.contextures.com/tiptech.html
    >
    >


  8. #8
    Dave Peterson
    Guest

    Re: Lost my Paste

    If you noticed, I just added a bunch of msgboxes to Ron's code.

    You can either remove those messages when you're happy, or even just try this
    against a copy of your workbook.



    Mike R wrote:
    >
    > Debra Thank you for the post
    > Makes sense that there can only be one SelectionChange procedure per sheet.
    > But If I replace Ron's code with Dave's I will have my pase back because
    > Ron's code is gone. If I just remove Ron"s code I have paste. Am I not
    > fully understanding something?
    >
    > "Debra Dalgleish" wrote:
    >
    > > I'm not Dave, but Dave's code should replace Ron's code -- you can only
    > > have one SelectionChange procedure per worksheet module.
    > >
    > > When you select a different cell, it will trigger the SelectionChange
    > > event, and the code will run. You'll see the messages in the code. The
    > > number in the last message displayed will tell you where the code
    > > stopped working.
    > >
    > > Mike R wrote:
    > > > 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
    > > >>
    > > >

    > >
    > >
    > > --
    > > Debra Dalgleish
    > > Excel FAQ, Tips & Book List
    > > http://www.contextures.com/tiptech.html
    > >
    > >


    --

    Dave Peterson

  9. #9
    Mike R
    Guest

    Re: Lost my Paste

    Thanks for the post back Dave
    I think I am catching up with you now. I will try that and see, thanks for
    staying with me on this, I really do appreciate it.

    Mike R

    "Dave Peterson" wrote:

    > If you noticed, I just added a bunch of msgboxes to Ron's code.
    >
    > You can either remove those messages when you're happy, or even just try this
    > against a copy of your workbook.
    >
    >
    >
    > Mike R wrote:
    > >
    > > Debra Thank you for the post
    > > Makes sense that there can only be one SelectionChange procedure per sheet.
    > > But If I replace Ron's code with Dave's I will have my pase back because
    > > Ron's code is gone. If I just remove Ron"s code I have paste. Am I not
    > > fully understanding something?
    > >
    > > "Debra Dalgleish" wrote:
    > >
    > > > I'm not Dave, but Dave's code should replace Ron's code -- you can only
    > > > have one SelectionChange procedure per worksheet module.
    > > >
    > > > When you select a different cell, it will trigger the SelectionChange
    > > > event, and the code will run. You'll see the messages in the code. The
    > > > number in the last message displayed will tell you where the code
    > > > stopped working.
    > > >
    > > > Mike R wrote:
    > > > > 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
    > > > >>
    > > > >
    > > >
    > > >
    > > > --
    > > > Debra Dalgleish
    > > > Excel FAQ, Tips & Book List
    > > > http://www.contextures.com/tiptech.html
    > > >
    > > >

    >
    > --
    >
    > Dave Peterson
    >


  10. #10
    Mike R
    Guest

    Re: Lost my Paste

    Dave
    You may have bitten off more than you want to chew with me. If so, just say
    so and I understand. Here is what I am getting after I replaced Ron’s code
    with yours:
    Selected any cell (C9) and msg box 1--0 appears, click “OK� and 7--0
    appears, click “OK and 8--0 appears. Right mouse click select “copy� & now I
    can copy (the cell is selected and the moving dash line is there). When I
    select a second cell to paste to (D9) msg box 1--1 appears, then 7--0, then
    8--0. When I clear all the msg boxes I loose my selected cell to paste. From
    here all I can do is relay what I am getting I wish I was half as good as
    some of you guys with this stuff and I might not need so much help. I can
    suggest that you make a sheet up and try it on your own. That way you can see
    first hand. Here is what I have, the cell locations obviously don’t really
    matter but: C6 formatted ddd mmm dd yyyy In H6 formatted mmm dd yyyy I have
    the formula =DATE(YEAR(C6),MONTH(C6)+1,0). From here I inserted the object
    Calendar 9.0, then of course the code from Ron that stopped my paste
    function. I removed Ron’s and replaced yours and here we are. I would like
    to keep the calendar and get back my paste if possible. If not I will do
    without the calendar!! Thank you soooo much for your help.

    Mike R


    "Dave Peterson" wrote:

    > If you noticed, I just added a bunch of msgboxes to Ron's code.
    >
    > You can either remove those messages when you're happy, or even just try this
    > against a copy of your workbook.
    >
    >
    >
    > Mike R wrote:
    > >
    > > Debra Thank you for the post
    > > Makes sense that there can only be one SelectionChange procedure per sheet.
    > > But If I replace Ron's code with Dave's I will have my pase back because
    > > Ron's code is gone. If I just remove Ron"s code I have paste. Am I not
    > > fully understanding something?
    > >
    > > "Debra Dalgleish" wrote:
    > >
    > > > I'm not Dave, but Dave's code should replace Ron's code -- you can only
    > > > have one SelectionChange procedure per worksheet module.
    > > >
    > > > When you select a different cell, it will trigger the SelectionChange
    > > > event, and the code will run. You'll see the messages in the code. The
    > > > number in the last message displayed will tell you where the code
    > > > stopped working.
    > > >
    > > > Mike R wrote:
    > > > > 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
    > > > >>
    > > > >
    > > >
    > > >
    > > > --
    > > > Debra Dalgleish
    > > > Excel FAQ, Tips & Book List
    > > > http://www.contextures.com/tiptech.html
    > > >
    > > >

    >
    > --
    >
    > Dave Peterson
    >


  11. #11
    Dave Peterson
    Guest

    Re: Lost my Paste

    Instead of using the irritating msgboxes, I used debug.prints (And I added a
    couple more...)


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

    I copied a cell and then selected a cell (but not C6).

    I got this back.
    -=-=-=-=-=-=-=
    1--1
    1.5--1
    6.5--1
    7--0
    8--0

    So the line between 6.5 and 7 cleared the .cutcopymode. That section is:

    Debug.Print "6.5--" & Application.CutCopyMode
    Calendar1.Visible = False
    Debug.Print "7--" & Application.CutCopyMode

    So hiding the calendar cleared the .cutcopymode.

    =====
    Then I tried it by copying a cell and selecting C6.

    I got this back:

    -=-=-=-=-=-=-=
    1--1
    1.5--1
    2--1
    3--0
    4--0
    5--0
    6--0
    8--0

    So the line between 2 and 3 broke the .cutcopymode.

    Debug.Print "2--" & Application.CutCopyMode
    Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
    Debug.Print "3--" & Application.CutCopyMode

    So setting the calendar's left position broke the .cutcopymode.

    ==
    I think you have to make a choice (and you already did!).

    But this isn't unusual. Running macros (even event macros like Ron's) can kill
    the .cutcopymode. And if you hadn't noticed, the Edit|Undo was probably broken,
    too.

    Such is life with macros.



    Mike R wrote:
    >
    > Dave
    > You may have bitten off more than you want to chew with me. If so, just say
    > so and I understand. Here is what I am getting after I replaced Ron’s code
    > with yours:
    > Selected any cell (C9) and msg box 1--0 appears, click “OK� and 7--0
    > appears, click “OK and 8--0 appears. Right mouse click select “copy� & now I
    > can copy (the cell is selected and the moving dash line is there). When I
    > select a second cell to paste to (D9) msg box 1--1 appears, then 7--0, then
    > 8--0. When I clear all the msg boxes I loose my selected cell to paste. From
    > here all I can do is relay what I am getting I wish I was half as good as
    > some of you guys with this stuff and I might not need so much help. I can
    > suggest that you make a sheet up and try it on your own. That way you can see
    > first hand. Here is what I have, the cell locations obviously don’t really
    > matter but: C6 formatted ddd mmm dd yyyy In H6 formatted mmm dd yyyy I have
    > the formula =DATE(YEAR(C6),MONTH(C6)+1,0). From here I inserted the object
    > Calendar 9.0, then of course the code from Ron that stopped my paste
    > function. I removed Ron’s and replaced yours and here we are. I would like
    > to keep the calendar and get back my paste if possible. If not I will do
    > without the calendar!! Thank you soooo much for your help.
    >
    > Mike R
    >
    > "Dave Peterson" wrote:
    >
    > > If you noticed, I just added a bunch of msgboxes to Ron's code.
    > >
    > > You can either remove those messages when you're happy, or even just try this
    > > against a copy of your workbook.
    > >
    > >
    > >
    > > Mike R wrote:
    > > >
    > > > Debra Thank you for the post
    > > > Makes sense that there can only be one SelectionChange procedure per sheet.
    > > > But If I replace Ron's code with Dave's I will have my pase back because
    > > > Ron's code is gone. If I just remove Ron"s code I have paste. Am I not
    > > > fully understanding something?
    > > >
    > > > "Debra Dalgleish" wrote:
    > > >
    > > > > I'm not Dave, but Dave's code should replace Ron's code -- you can only
    > > > > have one SelectionChange procedure per worksheet module.
    > > > >
    > > > > When you select a different cell, it will trigger the SelectionChange
    > > > > event, and the code will run. You'll see the messages in the code. The
    > > > > number in the last message displayed will tell you where the code
    > > > > stopped working.
    > > > >
    > > > > Mike R wrote:
    > > > > > 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
    > > > > >>
    > > > > >
    > > > >
    > > > >
    > > > > --
    > > > > Debra Dalgleish
    > > > > Excel FAQ, Tips & Book List
    > > > > http://www.contextures.com/tiptech.html
    > > > >
    > > > >

    > >
    > > --
    > >
    > > Dave Peterson
    > >


    --

    Dave Peterson

  12. #12
    Mike R
    Guest

    Re: Lost my Paste

    Dave you are a glutton for punishment...
    I thank you so much for the education, I know it was not without a time
    investment. You guys here are an exceptional asset to people like me that
    want to learn, and with people like you and your effort I can not fail.
    Thanks again.
    Mike R
    P.S. How long did it take you to learn all this? You are amazing!!!!

    "Dave Peterson" wrote:

    > Instead of using the irritating msgboxes, I used debug.prints (And I added a
    > couple more...)
    >
    >
    > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    > Debug.Print "-=-=-=-=-=-=-="
    > Debug.Print "1--" & Application.CutCopyMode
    > If Target.Cells.Count > 1 Then Exit Sub
    > Debug.Print "1.5--" & Application.CutCopyMode
    > If Not Application.Intersect(Range("C6"), Target) Is Nothing Then
    > Debug.Print "2--" & Application.CutCopyMode
    > Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
    > Debug.Print "3--" & Application.CutCopyMode
    > Calendar1.Top = Target.Top + Target.Height
    > Debug.Print "4--" & Application.CutCopyMode
    > Calendar1.Visible = True
    > Debug.Print "5--" & Application.CutCopyMode
    > ' select Today's date in the Calendar
    > Calendar1.Value = Date
    > Debug.Print "6--" & Application.CutCopyMode
    > Else
    > Debug.Print "6.5--" & Application.CutCopyMode
    > Calendar1.Visible = False
    > Debug.Print "7--" & Application.CutCopyMode
    > End If
    > Debug.Print "8--" & Application.CutCopyMode
    > End Sub
    >
    > I copied a cell and then selected a cell (but not C6).
    >
    > I got this back.
    > -=-=-=-=-=-=-=
    > 1--1
    > 1.5--1
    > 6.5--1
    > 7--0
    > 8--0
    >
    > So the line between 6.5 and 7 cleared the .cutcopymode. That section is:
    >
    > Debug.Print "6.5--" & Application.CutCopyMode
    > Calendar1.Visible = False
    > Debug.Print "7--" & Application.CutCopyMode
    >
    > So hiding the calendar cleared the .cutcopymode.
    >
    > =====
    > Then I tried it by copying a cell and selecting C6.
    >
    > I got this back:
    >
    > -=-=-=-=-=-=-=
    > 1--1
    > 1.5--1
    > 2--1
    > 3--0
    > 4--0
    > 5--0
    > 6--0
    > 8--0
    >
    > So the line between 2 and 3 broke the .cutcopymode.
    >
    > Debug.Print "2--" & Application.CutCopyMode
    > Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
    > Debug.Print "3--" & Application.CutCopyMode
    >
    > So setting the calendar's left position broke the .cutcopymode.
    >
    > ==
    > I think you have to make a choice (and you already did!).
    >
    > But this isn't unusual. Running macros (even event macros like Ron's) can kill
    > the .cutcopymode. And if you hadn't noticed, the Edit|Undo was probably broken,
    > too.
    >
    > Such is life with macros.
    >
    >
    >
    > Mike R wrote:
    > >
    > > Dave
    > > You may have bitten off more than you want to chew with me. If so, just say
    > > so and I understand. Here is what I am getting after I replaced Ron’s code
    > > with yours:
    > > Selected any cell (C9) and msg box 1--0 appears, click “OK� and 7--0
    > > appears, click “OK and 8--0 appears. Right mouse click select “copy� & now I
    > > can copy (the cell is selected and the moving dash line is there). When I
    > > select a second cell to paste to (D9) msg box 1--1 appears, then 7--0, then
    > > 8--0. When I clear all the msg boxes I loose my selected cell to paste. From
    > > here all I can do is relay what I am getting I wish I was half as good as
    > > some of you guys with this stuff and I might not need so much help. I can
    > > suggest that you make a sheet up and try it on your own. That way you can see
    > > first hand. Here is what I have, the cell locations obviously don’t really
    > > matter but: C6 formatted ddd mmm dd yyyy In H6 formatted mmm dd yyyy I have
    > > the formula =DATE(YEAR(C6),MONTH(C6)+1,0). From here I inserted the object
    > > Calendar 9.0, then of course the code from Ron that stopped my paste
    > > function. I removed Ron’s and replaced yours and here we are. I would like
    > > to keep the calendar and get back my paste if possible. If not I will do
    > > without the calendar!! Thank you soooo much for your help.
    > >
    > > Mike R
    > >
    > > "Dave Peterson" wrote:
    > >
    > > > If you noticed, I just added a bunch of msgboxes to Ron's code.
    > > >
    > > > You can either remove those messages when you're happy, or even just try this
    > > > against a copy of your workbook.
    > > >
    > > >
    > > >
    > > > Mike R wrote:
    > > > >
    > > > > Debra Thank you for the post
    > > > > Makes sense that there can only be one SelectionChange procedure per sheet.
    > > > > But If I replace Ron's code with Dave's I will have my pase back because
    > > > > Ron's code is gone. If I just remove Ron"s code I have paste. Am I not
    > > > > fully understanding something?
    > > > >
    > > > > "Debra Dalgleish" wrote:
    > > > >
    > > > > > I'm not Dave, but Dave's code should replace Ron's code -- you can only
    > > > > > have one SelectionChange procedure per worksheet module.
    > > > > >
    > > > > > When you select a different cell, it will trigger the SelectionChange
    > > > > > event, and the code will run. You'll see the messages in the code. The
    > > > > > number in the last message displayed will tell you where the code
    > > > > > stopped working.
    > > > > >
    > > > > > Mike R wrote:
    > > > > > > 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
    > > > > > >>
    > > > > > >
    > > > > >
    > > > > >
    > > > > > --
    > > > > > Debra Dalgleish
    > > > > > Excel FAQ, Tips & Book List
    > > > > > http://www.contextures.com/tiptech.html
    > > > > >
    > > > > >
    > > >
    > > > --
    > > >
    > > > Dave Peterson
    > > >

    >
    > --
    >
    > Dave Peterson
    >


  13. #13
    Dave Peterson
    Guest

    Re: Lost my Paste

    It's always a learning process.

    There are a lot of techniques you can pick up in the newsgroups (where I learned
    most).

    Just lurking helps, but trying is better (failing is ok, too).



    Mike R wrote:
    >
    > Dave you are a glutton for punishment...
    > I thank you so much for the education, I know it was not without a time
    > investment. You guys here are an exceptional asset to people like me that
    > want to learn, and with people like you and your effort I can not fail.
    > Thanks again.
    > Mike R
    > P.S. How long did it take you to learn all this? You are amazing!!!!
    >
    > "Dave Peterson" wrote:
    >
    > > Instead of using the irritating msgboxes, I used debug.prints (And I added a
    > > couple more...)
    > >
    > >
    > > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    > > Debug.Print "-=-=-=-=-=-=-="
    > > Debug.Print "1--" & Application.CutCopyMode
    > > If Target.Cells.Count > 1 Then Exit Sub
    > > Debug.Print "1.5--" & Application.CutCopyMode
    > > If Not Application.Intersect(Range("C6"), Target) Is Nothing Then
    > > Debug.Print "2--" & Application.CutCopyMode
    > > Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
    > > Debug.Print "3--" & Application.CutCopyMode
    > > Calendar1.Top = Target.Top + Target.Height
    > > Debug.Print "4--" & Application.CutCopyMode
    > > Calendar1.Visible = True
    > > Debug.Print "5--" & Application.CutCopyMode
    > > ' select Today's date in the Calendar
    > > Calendar1.Value = Date
    > > Debug.Print "6--" & Application.CutCopyMode
    > > Else
    > > Debug.Print "6.5--" & Application.CutCopyMode
    > > Calendar1.Visible = False
    > > Debug.Print "7--" & Application.CutCopyMode
    > > End If
    > > Debug.Print "8--" & Application.CutCopyMode
    > > End Sub
    > >
    > > I copied a cell and then selected a cell (but not C6).
    > >
    > > I got this back.
    > > -=-=-=-=-=-=-=
    > > 1--1
    > > 1.5--1
    > > 6.5--1
    > > 7--0
    > > 8--0
    > >
    > > So the line between 6.5 and 7 cleared the .cutcopymode. That section is:
    > >
    > > Debug.Print "6.5--" & Application.CutCopyMode
    > > Calendar1.Visible = False
    > > Debug.Print "7--" & Application.CutCopyMode
    > >
    > > So hiding the calendar cleared the .cutcopymode.
    > >
    > > =====
    > > Then I tried it by copying a cell and selecting C6.
    > >
    > > I got this back:
    > >
    > > -=-=-=-=-=-=-=
    > > 1--1
    > > 1.5--1
    > > 2--1
    > > 3--0
    > > 4--0
    > > 5--0
    > > 6--0
    > > 8--0
    > >
    > > So the line between 2 and 3 broke the .cutcopymode.
    > >
    > > Debug.Print "2--" & Application.CutCopyMode
    > > Calendar1.Left = Target.Left + Target.Width - Calendar1.Width
    > > Debug.Print "3--" & Application.CutCopyMode
    > >
    > > So setting the calendar's left position broke the .cutcopymode.
    > >
    > > ==
    > > I think you have to make a choice (and you already did!).
    > >
    > > But this isn't unusual. Running macros (even event macros like Ron's) can kill
    > > the .cutcopymode. And if you hadn't noticed, the Edit|Undo was probably broken,
    > > too.
    > >
    > > Such is life with macros.
    > >
    > >
    > >
    > > Mike R wrote:
    > > >
    > > > Dave
    > > > You may have bitten off more than you want to chew with me. If so, just say
    > > > so and I understand. Here is what I am getting after I replaced Ron’s code
    > > > with yours:
    > > > Selected any cell (C9) and msg box 1--0 appears, click “OK� and 7--0
    > > > appears, click “OK and 8--0 appears. Right mouse click select “copy� & now I
    > > > can copy (the cell is selected and the moving dash line is there). When I
    > > > select a second cell to paste to (D9) msg box 1--1 appears, then 7--0, then
    > > > 8--0. When I clear all the msg boxes I loose my selected cell to paste. From
    > > > here all I can do is relay what I am getting I wish I was half as good as
    > > > some of you guys with this stuff and I might not need so much help. I can
    > > > suggest that you make a sheet up and try it on your own. That way you can see
    > > > first hand. Here is what I have, the cell locations obviously don’t really
    > > > matter but: C6 formatted ddd mmm dd yyyy In H6 formatted mmm dd yyyy I have
    > > > the formula =DATE(YEAR(C6),MONTH(C6)+1,0). From here I inserted the object
    > > > Calendar 9.0, then of course the code from Ron that stopped my paste
    > > > function. I removed Ron’s and replaced yours and here we are. I would like
    > > > to keep the calendar and get back my paste if possible. If not I will do
    > > > without the calendar!! Thank you soooo much for your help.
    > > >
    > > > Mike R
    > > >
    > > > "Dave Peterson" wrote:
    > > >
    > > > > If you noticed, I just added a bunch of msgboxes to Ron's code.
    > > > >
    > > > > You can either remove those messages when you're happy, or even just try this
    > > > > against a copy of your workbook.
    > > > >
    > > > >
    > > > >
    > > > > Mike R wrote:
    > > > > >
    > > > > > Debra Thank you for the post
    > > > > > Makes sense that there can only be one SelectionChange procedure per sheet.
    > > > > > But If I replace Ron's code with Dave's I will have my pase back because
    > > > > > Ron's code is gone. If I just remove Ron"s code I have paste. Am I not
    > > > > > fully understanding something?
    > > > > >
    > > > > > "Debra Dalgleish" wrote:
    > > > > >
    > > > > > > I'm not Dave, but Dave's code should replace Ron's code -- you can only
    > > > > > > have one SelectionChange procedure per worksheet module.
    > > > > > >
    > > > > > > When you select a different cell, it will trigger the SelectionChange
    > > > > > > event, and the code will run. You'll see the messages in the code. The
    > > > > > > number in the last message displayed will tell you where the code
    > > > > > > stopped working.
    > > > > > >
    > > > > > > Mike R wrote:
    > > > > > > > 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
    > > > > > > >>
    > > > > > > >
    > > > > > >
    > > > > > >
    > > > > > > --
    > > > > > > Debra Dalgleish
    > > > > > > Excel FAQ, Tips & Book List
    > > > > > > http://www.contextures.com/tiptech.html
    > > > > > >
    > > > > > >
    > > > >
    > > > > --
    > > > >
    > > > > Dave Peterson
    > > > >

    > >
    > > --
    > >
    > > Dave Peterson
    > >


    --

    Dave Peterson

  14. #14
    Registered User
    Join Date
    08-28-2005
    Posts
    8

    Kill Cut & Paste

    Sorry to hear about your trouble.

    However I WANT TO KILL CUT & PASTE.

    ...to prevent users from (unknowingly) pasting Conditional Formats and Data Validation properties into "new" cells.

    Have you found a way TO MAKE IT HAPPEN?

    Here is a segment from my Auto_Open Macro
    ======================================================
    Application.DefaultSaveFormat = xlNormal
    Worksheets("Inputs&Actuals").Activate
    Sheets("Inputs&Actuals").Select
    Range("I6").Select

    CreateWorkbookMenus
    CreateChartMenus

    Application.CellDragAndDrop = False
    ' Added 8-28-05
    Application.CutCopyMode = False


    Company = Range("CompanyName").Value
    =======================================================
    The line that reads

    Application.CutCopyMode = False

    seems to be what I need. but it doesn't work

    two lines before kills Drag & Drop, but I can still Cut/Paste.

    Any Clues?....Help?...

    Debra??

  15. #15
    Dave Peterson
    Guest

    Re: Lost my Paste

    You have another reply at your other post.

    my911 wrote:
    >
    > Sorry to hear about your trouble.
    >
    > However I WANT TO KILL CUT & PASTE.
    >
    > ..to prevent users from (unknowingly) pasting Conditional Formats and
    > Data Validation properties into "new" cells.
    >
    > Have you found a way TO MAKE IT HAPPEN?
    >
    > Here is a segment from my Auto_Open Macro
    > ======================================================
    > Application.DefaultSaveFormat = xlNormal
    > Worksheets("Inputs&Actuals").Activate
    > Sheets("Inputs&Actuals").Select
    > Range("I6").Select
    >
    > CreateWorkbookMenus
    > CreateChartMenus
    >
    > Application.CellDragAndDrop = False
    > ' Added 8-28-05
    > Application.CutCopyMode = False
    >
    > Company = Range("CompanyName").Value
    > =======================================================
    > The line that reads
    >
    > Application.CutCopyMode = False
    >
    > seems to be what I need. but it doesn't work
    >
    > two lines before kills Drag & Drop, but I can still Cut/Paste.
    >
    > Any Clues?....Help?...
    >
    > Debra??
    >
    > --
    > my911
    > ------------------------------------------------------------------------
    > my911's Profile: http://www.excelforum.com/member.php...o&userid=26733
    > View this thread: http://www.excelforum.com/showthread...hreadid=337783


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1