ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   "Do you want to replace the contents of the destination cells?" (https://www.excelbanter.com/excel-discussion-misc-queries/126185-do-you-want-replace-contents-destination-cells.html)

Bob Barnes

"Do you want to replace the contents of the destination cells?"
 
I have an AUTO_OPEN macro...

Sometimes, I get the Message Above w/ Yes and No Buttons.

Why does this occur...can I turn it off?

TIA - Bob

ExcelBanter AI

Answer: "Do you want to replace the contents of the destination cells?"
 
Hi Bob,

The message you are seeing is a warning message that Excel displays when you are copying data from one cell to another and the destination cell already contains data. The message is asking if you want to replace the existing data with the new data.

The reason you are seeing this message is because your macro is copying data to a cell that already contains data. If you want to turn off this warning message, you can add the following line of code to your macro before the copy command:

Code:

Application.DisplayAlerts = False
This will turn off all warning messages in Excel, including the one you are seeing. However, be careful when using this command, as it can suppress other important warning messages as well.

If you want to avoid overwriting existing data, you can modify your macro to check if the destination cell is empty before copying data to it. You can do this by using an IF statement in your macro.

Here are the steps to modify your macro:
  1. Find the line in your macro that copies data to the destination cell.
  2. Add an IF statement before the copy command to check if the destination cell is empty. The IF statement should look like this:

    Code:

    If Range("destination_cell").Value = "" Then
    Replace "destination_cell" with the cell reference of the destination cell.
  3. Add an END IF statement after the copy command to close the IF statement. The END IF statement should look like this:

    Code:

    End If

After your macro has finished running, you should turn the warning messages back on by adding the following line of code:

Code:

Application.DisplayAlerts = True

Gord Dibben

"Do you want to replace the contents of the destination cells?"
 
Your Auto_Open code is obviously trying to paste something into filled cells or
similar operation like Text to Columns.

You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Check your code to see what it is doing before adding more code to turn off the
message.


Gord Dibben MS Excel MVP


On Mon, 15 Jan 2007 11:02:01 -0800, Bob Barnes
wrote:

I have an AUTO_OPEN macro...

Sometimes, I get the Message Above w/ Yes and No Buttons.

Why does this occur...can I turn it off?

TIA - Bob



Bob Barnes

"Do you want to replace the contents of the destination cells?
 
Gord - Thank you.

I'm not sure what is causing...
Your Auto_Open code is obviously trying to paste something into filled cells
or
similar operation like Text to Columns.

Your..
You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Bob -- Yes, I'd like to turnoff the MsgBox and default to Yes replacing
destination cells...How do I do that? Everything is being populated via
automation from Access...and is doing what is needed.

TIA - Bob

"Gord Dibben" wrote:

Your Auto_Open code is obviously trying to paste something into filled cells or
similar operation like Text to Columns.

You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Check your code to see what it is doing before adding more code to turn off the
message.


Gord Dibben MS Excel MVP


On Mon, 15 Jan 2007 11:02:01 -0800, Bob Barnes
wrote:

I have an AUTO_OPEN macro...

Sometimes, I get the Message Above w/ Yes and No Buttons.

Why does this occur...can I turn it off?

TIA - Bob




Dave Peterson

"Do you want to replace the contents of the destination cells?
 
Sometimes, this'll work:

Application.displayalerts = false
'your code that causes the alert to appear
application.displayalerts = true



Bob Barnes wrote:

Gord - Thank you.

I'm not sure what is causing...
Your Auto_Open code is obviously trying to paste something into filled cells
or
similar operation like Text to Columns.

Your..
You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Bob -- Yes, I'd like to turnoff the MsgBox and default to Yes replacing
destination cells...How do I do that? Everything is being populated via
automation from Access...and is doing what is needed.

TIA - Bob

"Gord Dibben" wrote:

Your Auto_Open code is obviously trying to paste something into filled cells or
similar operation like Text to Columns.

You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Check your code to see what it is doing before adding more code to turn off the
message.


Gord Dibben MS Excel MVP


On Mon, 15 Jan 2007 11:02:01 -0800, Bob Barnes
wrote:

I have an AUTO_OPEN macro...

Sometimes, I get the Message Above w/ Yes and No Buttons.

Why does this occur...can I turn it off?

TIA - Bob




--

Dave Peterson

Bob Barnes

"Do you want to replace the contents of the destination cells?
 
That works..Thank you.

Only question. Since the Focus is set to "Yes"...that should answer as "Yes".

Thanks again - Bob

"Dave Peterson" wrote:

Sometimes, this'll work:

Application.displayalerts = false
'your code that causes the alert to appear
application.displayalerts = true



Bob Barnes wrote:

Gord - Thank you.

I'm not sure what is causing...
Your Auto_Open code is obviously trying to paste something into filled cells
or
similar operation like Text to Columns.

Your..
You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Bob -- Yes, I'd like to turnoff the MsgBox and default to Yes replacing
destination cells...How do I do that? Everything is being populated via
automation from Access...and is doing what is needed.

TIA - Bob

"Gord Dibben" wrote:

Your Auto_Open code is obviously trying to paste something into filled cells or
similar operation like Text to Columns.

You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Check your code to see what it is doing before adding more code to turn off the
message.


Gord Dibben MS Excel MVP


On Mon, 15 Jan 2007 11:02:01 -0800, Bob Barnes
wrote:

I have an AUTO_OPEN macro...

Sometimes, I get the Message Above w/ Yes and No Buttons.

Why does this occur...can I turn it off?

TIA - Bob



--

Dave Peterson


Dave Peterson

"Do you want to replace the contents of the destination cells?
 
Nope.

This doesn't even see the warning box--it just assumes that you don't want to be
bothered by the warning and that you know what you're doing.

Bob Barnes wrote:

That works..Thank you.

Only question. Since the Focus is set to "Yes"...that should answer as "Yes".

Thanks again - Bob

"Dave Peterson" wrote:

Sometimes, this'll work:

Application.displayalerts = false
'your code that causes the alert to appear
application.displayalerts = true



Bob Barnes wrote:

Gord - Thank you.

I'm not sure what is causing...
Your Auto_Open code is obviously trying to paste something into filled cells
or
similar operation like Text to Columns.

Your..
You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Bob -- Yes, I'd like to turnoff the MsgBox and default to Yes replacing
destination cells...How do I do that? Everything is being populated via
automation from Access...and is doing what is needed.

TIA - Bob

"Gord Dibben" wrote:

Your Auto_Open code is obviously trying to paste something into filled cells or
similar operation like Text to Columns.

You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Check your code to see what it is doing before adding more code to turn off the
message.


Gord Dibben MS Excel MVP


On Mon, 15 Jan 2007 11:02:01 -0800, Bob Barnes
wrote:

I have an AUTO_OPEN macro...

Sometimes, I get the Message Above w/ Yes and No Buttons.

Why does this occur...can I turn it off?

TIA - Bob



--

Dave Peterson


--

Dave Peterson

Bob Barnes

"Do you want to replace the contents of the destination cells?
 
Dave - Not sure why the "warning" appears, but the data I need
is there from the automation code in Access.

Thanks again - Bob

"Dave Peterson" wrote:

Nope.

This doesn't even see the warning box--it just assumes that you don't want to be
bothered by the warning and that you know what you're doing.

Bob Barnes wrote:

That works..Thank you.

Only question. Since the Focus is set to "Yes"...that should answer as "Yes".

Thanks again - Bob

"Dave Peterson" wrote:

Sometimes, this'll work:

Application.displayalerts = false
'your code that causes the alert to appear
application.displayalerts = true



Bob Barnes wrote:

Gord - Thank you.

I'm not sure what is causing...
Your Auto_Open code is obviously trying to paste something into filled cells
or
similar operation like Text to Columns.

Your..
You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Bob -- Yes, I'd like to turnoff the MsgBox and default to Yes replacing
destination cells...How do I do that? Everything is being populated via
automation from Access...and is doing what is needed.

TIA - Bob

"Gord Dibben" wrote:

Your Auto_Open code is obviously trying to paste something into filled cells or
similar operation like Text to Columns.

You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Check your code to see what it is doing before adding more code to turn off the
message.


Gord Dibben MS Excel MVP


On Mon, 15 Jan 2007 11:02:01 -0800, Bob Barnes
wrote:

I have an AUTO_OPEN macro...

Sometimes, I get the Message Above w/ Yes and No Buttons.

Why does this occur...can I turn it off?

TIA - Bob



--

Dave Peterson


--

Dave Peterson


Dave Peterson

"Do you want to replace the contents of the destination cells?
 
I don't understand.

You said it works, but now it sounds like you still see the message.

Bob Barnes wrote:

Dave - Not sure why the "warning" appears, but the data I need
is there from the automation code in Access.

Thanks again - Bob

"Dave Peterson" wrote:

Nope.

This doesn't even see the warning box--it just assumes that you don't want to be
bothered by the warning and that you know what you're doing.

Bob Barnes wrote:

That works..Thank you.

Only question. Since the Focus is set to "Yes"...that should answer as "Yes".

Thanks again - Bob

"Dave Peterson" wrote:

Sometimes, this'll work:

Application.displayalerts = false
'your code that causes the alert to appear
application.displayalerts = true



Bob Barnes wrote:

Gord - Thank you.

I'm not sure what is causing...
Your Auto_Open code is obviously trying to paste something into filled cells
or
similar operation like Text to Columns.

Your..
You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Bob -- Yes, I'd like to turnoff the MsgBox and default to Yes replacing
destination cells...How do I do that? Everything is being populated via
automation from Access...and is doing what is needed.

TIA - Bob

"Gord Dibben" wrote:

Your Auto_Open code is obviously trying to paste something into filled cells or
similar operation like Text to Columns.

You can turn off the message and have it default to "Yes" but are you sure you
want the destination cells to be replaced?

Check your code to see what it is doing before adding more code to turn off the
message.


Gord Dibben MS Excel MVP


On Mon, 15 Jan 2007 11:02:01 -0800, Bob Barnes
wrote:

I have an AUTO_OPEN macro...

Sometimes, I get the Message Above w/ Yes and No Buttons.

Why does this occur...can I turn it off?

TIA - Bob



--

Dave Peterson


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 02:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com