+ Reply to Thread
Results 1 to 15 of 15

Double click event with multiple if statements

  1. #1
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Double click event with multiple if statements

    Hi all,
    I am trying double click event.
    Code is as follows:
    Please Login or Register  to view this content.
    Not getting there yet.
    Any help please
    Kind regards

  2. #2
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Double click event with multiple if statements

    Sorry this should be (14) and not (17) in the red coloured font in second If statement

    Please Login or Register  to view this content.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Double click event with multiple if statements

    Is there a problem with the code?
    If posting code please use code tags, see here.

  4. #4
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Double click event with multiple if statements

    Hi Norie,
    Yes indeed.
    It goes to debug and at times the row is deleted but does not go anywhere. I did search through other sheets also.
    Something strange that I cant understand.
    Kind regards

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Double click event with multiple if statements

    Try adding Cancel = True to the code to stop Excel entering edit mode, which is normally what happens when you click a cell.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Double click event with multiple if statements

    Hi Norie,
    Thanks again.
    Apology. Both if statements are working in isolation, but when combined the first If 'Not' does not work.
    I will try again.
    Kind regards

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Double click event with multiple if statements

    Not sure what you mean, there is only one If with 'Not'.

    What in words is the logic you want to apply?

  8. #8
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Double click event with multiple if statements

    Hi Norie,
    What I mean is the line in the code:
    Please Login or Register  to view this content.
    This is causing an issue.
    with previous suggestion it goes as far as populating current date and time.
    Thanks
    Kind regards

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Double click event with multiple if statements

    What issue is it causing?

  10. #10
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Double click event with multiple if statements

    Its really amazing.
    Now the previously working code also has stopped working.
    It does populate the date & time
    It also deletes the row

    But can not say for sure where the row is pasted??.
    I am now re-doing the entire work book.
    Thanks

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Double click event with multiple if statements

    The data is being pasted in either Sheets(5) or Sheets(9), it's going to the next empty row of the relevant sheet.

    This code is closer to the original code.
    Please Login or Register  to view this content.
    That code will put the date/time in a cell when double clicked if the cell is in column Q.

    If it's a cell in column N that's been double clicked and the value in the cell is 'Not' then the entire row the of the double-clicked cell will be copied to the next empty row on Sheets(9).

    If a cell is double clicked anywhere else on the sheet then the row of the double clicked cell is copied to the next empty row on Sheets(5), then the row is deleted.

    Is that what you want the code to do?

  12. #12
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Double click event with multiple if statements

    Hi Norie,
    Really thanks. Still the same. Apology. Cant find the pasted row anywhere in the workbook sheet 5 or 9 . The sheets 5 & 9 are empty.
    Actually I have realised that in this double click event, there is a change event.
    What if I separate them and re-write.
    double click will populate date & time.
    Change event will cut & paste to appropriate sheet depending upon what is there in N:N
    I do appreciate you are helping me during your valuable time
    Kind regards
    Kind regards

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Double click event with multiple if statements

    If there is a change event then it could be affecting the double-click code, and vice versa.

    It could even be that the copy isn't happening.

  14. #14
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Double click event with multiple if statements

    That's true.
    Let me write both codes and I will post them for your expert advice.
    Great learning for me.
    Thanks

  15. #15
    Forum Contributor
    Join Date
    02-19-2013
    Location
    UK
    MS-Off Ver
    Excel 2019
    Posts
    677

    Re: Double click event with multiple if statements

    Hi Norie,
    I have modified the code and made it in two parts
    1- populate date & time by double clicking- works fine
    2- Change event- when date & time is populated then change event kicks in and does the action of copying and pasting.
    The second code is as follows:
    Please Login or Register  to view this content.
    Thanks for your help again Norie
    Kind regards

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Double Click Event Help
    By mannymg in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-13-2014, 02:56 PM
  2. Double Click Event
    By CARONTE in forum Excel General
    Replies: 6
    Last Post: 06-16-2009, 12:41 AM
  3. Double click event
    By CARONTE in forum Excel General
    Replies: 1
    Last Post: 06-14-2009, 03:02 AM
  4. Double click event
    By baz0912 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2008, 05:56 PM
  5. userform label double-click goes to click event
    By John Paul Fullerton in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-19-2006, 01:00 PM

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