+ Reply to Thread
Results 1 to 15 of 15

Bypass a Dialog Box

  1. #1
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Bypass a Dialog Box

    When I run the following code, a dialog box pops up asking if I want to replace the contents of the destination cells, which I do want to? How can I bypass this dialog box?
    Please Login or Register  to view this content.
    Thank You
    Last edited by Aland2929; 05-15-2010 at 11:37 AM.

  2. #2
    Forum Contributor Bob@Sun's Avatar
    Join Date
    09-03-2009
    Location
    Montuak, Usa
    MS-Off Ver
    Excel 2007
    Posts
    438

    Re: Bypass a Dialog Box

    Try this

    Please Login or Register  to view this content.
    Last edited by Bob@Sun; 05-15-2010 at 10:40 AM.

  3. #3
    Forum Contributor Bob@Sun's Avatar
    Join Date
    09-03-2009
    Location
    Montuak, Usa
    MS-Off Ver
    Excel 2007
    Posts
    438

    Re: Bypass a Dialog Box

    The logic is that you need to delete the old content before pasting the new one.

  4. #4
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Bypass a Dialog Box

    Quote Originally Posted by Bob@Sun View Post
    Try this

    Please Login or Register  to view this content.
    When I run this code, it has a problem with the
    Please Login or Register  to view this content.
    ?

  5. #5
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Bypass a Dialog Box

    Quote Originally Posted by Aland2929 View Post
    When I run this code, it has a problem with the
    Please Login or Register  to view this content.
    ?
    I also think the "ClearContents" will delete the data I want to paste?

  6. #6
    Forum Contributor Bob@Sun's Avatar
    Join Date
    09-03-2009
    Location
    Montuak, Usa
    MS-Off Ver
    Excel 2007
    Posts
    438

    Re: Bypass a Dialog Box

    If you provide a sample file I will be able to test it and see where the problem is.

  7. #7
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Bypass a Dialog Box

    If you want to bypass a dialogue box you would add application.DisplayAlerts

    When working with an object you do not have to use select or selection, this only slows down the code.

    Instead try...

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor Bob@Sun's Avatar
    Join Date
    09-03-2009
    Location
    Montuak, Usa
    MS-Off Ver
    Excel 2007
    Posts
    438

    Re: Bypass a Dialog Box

    Why would you copy and then paste in the same plase???

    I was thinking another range was selected previouslly and that is where you need to paste.

  9. #9
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Bypass a Dialog Box

    I can't see why your code doesn't work

    However
    Please Login or Register  to view this content.

    Replace "A2" with the position on the sheet that suits you.

    The message you get "Do want to replace the contents of the destination cells?"
    only appears when you use drag and drop. I don't see why you should get it using copy/pastespecial code

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Bypass a Dialog Box

    You don't need to copy & paste
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  11. #11
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Bypass a Dialog Box

    Quote Originally Posted by jeffreybrown View Post
    If you want to bypass a dialogue box you would add application.DisplayAlerts

    When working with an object you do not have to use select or selection, this only slows down the code.

    Instead try...

    Please Login or Register  to view this content.
    Thank You very much. It nows works perfectly.

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Bypass a Dialog Box

    Check the code that I posted. Presumably you are converting formulas to values

  13. #13
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Bypass a Dialog Box

    Quote Originally Posted by royUK View Post
    Check the code that I posted. Presumably you are converting formulas to values
    Thank you Roy for that direction. Much simplier and cleaner. Still many things to learn.

  14. #14
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Bypass a Dialog Box

    We are all still learning

  15. #15
    Forum Contributor
    Join Date
    06-11-2009
    Location
    Cape Town
    MS-Off Ver
    Microsoft 365
    Posts
    854

    Re: Bypass a Dialog Box

    Quote Originally Posted by royUK View Post
    Check the code that I posted. Presumably you are converting formulas to values
    Thanks Roy. That works perfectly. I also learnt about Application.Display.Alerts which might be useful one day.

+ 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