Problem to Merge command

Hi,
What is the reason to get
23b.png
due to Merge command of attached file below?
Remedy_Incidents_Analysis_-A4-_New.xlsm
LVL 11
HuaMin ChenProblem resolverAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
You will get that prompt if you try to merge the cells if they are not empty and in the end, the merged cells will contain the value from the left most cell of the merged cells.
0
HuaMin ChenProblem resolverAuthor Commented:
How to avoid current problem?
0
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
When you are getting that error?
Which sheet is present before running the code in your attached file?
If I run the code in the existing file, it will throw an error as there cannot be two sheets in the workbook with the same name and your are adding the sheets and renaming them without checking if the sheet name is already taken.

So please upload a file without running the code so that it doesn't have an extra sheet.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
BTW you may add the following line to ignore that prompt...

Application.DisplayAlerts = False

Open in new window

0
HuaMin ChenProblem resolverAuthor Commented:
I already have this line
Application.DisplayAlerts = False    

Open in new window

and error is due to

            WorkRng.Parent.Range(rng.Cells(i, 1), rng.Cells(j - 1, 1)).Merge

Open in new window

if you have a try to run macro in attached file.
Remedy_Incidents_Analysis_-A4-_New.xlsm
0
Subodh Tiwari (Neeraj)Excel & VBA ExpertCommented:
I ran the code and it completed without any such error.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.