Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default prevent Excel from popping-up an "OK" (information) message

My macro merges various cells (A1 thru K1) at various times. A1 thru E1 are
already merged as one cell but I want to merge them with cells F1:K1. But
when my macro does that, Excel displays this message (and requires that the
User hit "OK"):
"The selection contains multiple data values. Merging into one cell will
keep the upper-left most data only."

I don't want the User to have to hit "OK" every time that the macro merges
the cells (which happens about 20 times) ... how do I tell Excel to
automatically perform the merge without popping-up that message?

Dan

(BTW ... I love this Excel Discussion Group ... you people are SO smart!)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default prevent Excel from popping-up an "OK" (information) message

You need to toggle the display alerts setting. Any time you play with these
settings you are best to use an error handler to take care of the inevitable
crashes (something will go wrong eventually so you may as well deal with it
before it happens)

sub DoMyStuff()
On Error Goto ErrorHandler
application.displayalerts = false
'Merge like there was no tomorrow

ErrorHandler:
application.displayalerts = true
end sub

--
HTH...

Jim Thomlinson


"crimsonkng" wrote:

My macro merges various cells (A1 thru K1) at various times. A1 thru E1 are
already merged as one cell but I want to merge them with cells F1:K1. But
when my macro does that, Excel displays this message (and requires that the
User hit "OK"):
"The selection contains multiple data values. Merging into one cell will
keep the upper-left most data only."

I don't want the User to have to hit "OK" every time that the macro merges
the cells (which happens about 20 times) ... how do I tell Excel to
automatically perform the merge without popping-up that message?

Dan

(BTW ... I love this Excel Discussion Group ... you people are SO smart!)

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default prevent Excel from popping-up an "OK" (information) message

Thanks, Jim. Yer a pal.
Dan

"Jim Thomlinson" wrote:

You need to toggle the display alerts setting. Any time you play with these
settings you are best to use an error handler to take care of the inevitable
crashes (something will go wrong eventually so you may as well deal with it
before it happens)

sub DoMyStuff()
On Error Goto ErrorHandler
application.displayalerts = false
'Merge like there was no tomorrow

ErrorHandler:
application.displayalerts = true
end sub

--
HTH...

Jim Thomlinson


"crimsonkng" wrote:

My macro merges various cells (A1 thru K1) at various times. A1 thru E1 are
already merged as one cell but I want to merge them with cells F1:K1. But
when my macro does that, Excel displays this message (and requires that the
User hit "OK"):
"The selection contains multiple data values. Merging into one cell will
keep the upper-left most data only."

I don't want the User to have to hit "OK" every time that the macro merges
the cells (which happens about 20 times) ... how do I tell Excel to
automatically perform the merge without popping-up that message?

Dan

(BTW ... I love this Excel Discussion Group ... you people are SO smart!)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default prevent Excel from popping-up an "OK" (information) message


You can try the following code before start the procedu

Application.ScreenUpdating = false

Do not forget to set it true after finished!

If it does not work, try the "send keys":

send keys "{ENTER}", TRUE

Regards

--
lgarci
-----------------------------------------------------------------------
lgarcia's Profile: http://www.excelforum.com/member.php...nfo&userid=952
View this thread: http://www.excelforum.com/showthread.php?threadid=48025

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
"excel "macros may be disabled" message using an xlam file frustrated Excel Worksheet Functions 2 July 13th 09 08:32 PM
Stop the "Personal" sheet from popping up every time I open a work George B Excel Discussion (Misc queries) 2 December 21st 07 10:46 PM
In Excel 2003 is there a way to prevent "Save As" and "Print"? lucky2000 Excel Discussion (Misc queries) 3 April 26th 07 02:49 PM
"Cannot empty clipboard" message keeps popping up Amy Excel Discussion (Misc queries) 2 March 16th 06 06:52 PM
Prevent "XYZ.doc is locked for editing" message Greg Wilson Excel Programming 2 September 5th 05 09:17 AM


All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"