Help with existing code
Results 1 to 2 of 2

Thread: Help with existing code
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Apr 2013
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    Default Help with existing code

    Hi can anyone please help I have the following VBA Code that works great but what I know would like to do is rather than the code copy the first 4 cells on a row when I double click, let’s say cells A1-A4, can the code not touch and leave cell A3 alone . So even if I was to modify the code below to copy more cells say A1-A10 it would always leave Cell A3 alone
    thank anyone you can help

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    'Modified 6/18/2019 2:29:06 PM EDT
    If Target.Column = 5 And Target.Row > 1 Then
    Cancel = True
    Dim Lastrow As Long
    Lastrow = Sheets(2).Cells(Rows.Count, "A").End(xlUp).Row + 1
    Target.Offset(, -4).Resize(, 4).Copy Sheets(2).Cells(Lastrow, 1)
    End If
    End Sub

  2. #2
    Moderator mole999's Avatar
    Join Date
    Oct 2004
    Post Thanks / Like
    16 Post(s)
    2 Thread(s)

    Default Re: Help with existing code

    not sure but can you hide that row in the code when run and then unhide after. It happens often to me manually when I select filtered data ?
    • Yes I know there are better ways to do it. I just wish I knew them. - 97, 2003, 2007, 2010, 2013, 2016 & 2019
    • I wear my ignorance openly, excel is not my chosen career, its a means to an ends
    • Posting Guidelines Want to post well laid out questions and answers Translate Excel Versions
      [CODE ]Put Your Code[/ CODE]
    • Settings > General Settings (on the left) scroll to the bottom, > Miscellaneous Options > Use ENHANCED
    • X-Posting Guidelines Rule 13 > CHART STUFF

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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