• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How does 'Application.AlertBeforeOverwriting = True' works

ThrottleWorks

Excel Ninja
Hi,

This is not a real world problem however I am not able understand this code when run with dummy data.

There are already values in TempRng, when I run below mentioned code, I did not get any alert.

Code:
Application.AlertBeforeOverwriting = True
       
        Dim TempRng As Range
        Set TempRng = Range("F1:F5")
       
        For Each Rng In TempRng
            Rng.Value = "S"
        Next

I tried doing Google for this but it's not helping either. Can anyone please help me in this.
 
Hi,

To my understanding it works on non-blank cells or ranges while the operation performed is not pasting data or editing the range but it triggers an alert if the editing occurs due to drag and drop operation…

However, I am really not 100% sure about it, I will have to test it to check if my understanding is right…Meanwhile, lets see what others have to say about it.
 
As far as I know, Application.AlertBeforeOverwriting = True is only applied when doing manual drag and drop operation to non blank cell.

If all data manipulation is done via code, it won't have any impact.
 
Put Data in A1 and E1.

Have different value in it.

Hover over E1 and move mouse till you get 4 way arrow sign. Left click and drag over A1 and let go. You should see following message pop up.
upload_2016-1-25_9-55-47.png
 
Hi @Chihiro sir, thanks for the detailed explanation. I am not getting the same warning. May be I am doing something wrong.

I have 'Application.AlertBeforeOverwriting = True' in my code. Run it, tried as mentioned above but no success yet. But now I got how it works.
 
Hmm, not sure what's the issue.

I tested on my end with following and the code does turn on or off alert when drag & drop is used.

Code:
Sub owAlertOff()
Application.AlertBeforeOverwriting = False
End Sub
Sub owAlertOn()
Application.AlertBeforeOverwriting = True
End Sub
 
Hi @Chihiro sir, no it is still not working for me, anyways it is not a real world issue for me so I find it un-comfortable to trouble you more on this.

Have a nice day ahead. :)
 
Back
Top