Announcements
Hi all,
I have included the following codes for merge of cells in excel , in excel buffer in navision.
XlWrkSht := XlApp.ActiveSheet;
XlWrkSht.Range(FromRec.xlColID + FromRec.xlRowID + ':' + ToRec.xlColID + ToRec.xlRowID).Select;
XlWrkSht.Range(FromRec.xlColID + FromRec.xlRowID).HorizontalAlignment := -4108;
XlWrkSht.Range(FromRec.xlColID + FromRec.xlRowID + ':' + ToRec.xlColID + ToRec.xlRowID).cells.Merge;
The code is working properly. but it keeps on popping warning message.
"The selection contains multiple data values. Uniting in a single cell will be retained only the data in the upper left."
I tried to find out the issue,but cannot understand,
Could any one help, how to proceed.
*This post is locked for comments
Thank you all very much, for your kind support and guidance.
The Problem in my case is that I have inserted a Empty value ('') next to the cell , That i was trying to merge.
for example
Please refer Fig1.
Solution, as suggested by all of you, I have removed the empty value which i was trying to merge along with cell valve.
Now it is working fine.
Thank you experts for giving your valuable time and suggestion .
Hello Vijay,
follow the saurav solution, Why because it's an excel warning, you can check in MS excel also.
Hi Vijay,
If you merge the four cells (Column A to Column D) as mentioned in the screen shot, you would definitely get such error.
You can not merge the multiple cells having values in all the columns, otherwise system would retain only Upper Left column value.
You can try to merge the cell in Excel directly and you would find similar issue in excel as well.
If you want to merge the cells, only one cell should have value, otherwise you would get such error.
Hope this helps.
This message is not because of your coding, but due to the Excel behavior itself. Trying to merge two or more cells in Excel itself will produce you a warning message. You can first clean the cells (perhaps, reading and storing the values in some variable), merge them, and only then put the values there into a merged cell.
Your Coding is correct, the error message is not due to the coding its due to the excel. Even if you try this in excel the same error message will popup.
The way you are approaching the solution need to be changed -
1. While writing content in excel buffer table concatenate the string that you want to place in A2,B2,C2&D2 and put that value in A2.
2. So your string in A2 will be "Sample Entry For Test".
3. Now use merge cell function to merge A2,B2,C2 and D2 to expand the size of column A2.
Hope it make sense.
I have tried already , withwhat ever suggestion you gave.
Still Im getting the same warning message.
I dont understand it.
Any Suggestion .Further
For NAV 2009 Refer here -
saurav-nav.blogspot.in/.../navision-export-to-excel-with-merge.html
Thank you Suresh and Binesh for your valuble input.
I understood the solution and i have applied the same in my coding too.
But i would make it more clear for both of you ...That why the problem occurs.
I insert the value first and the i tried to apply merge the cells in excel.
Please refer Fig 1
When trying to merge the cells , which is already having value .. i am getting this warning mesaage.
When trying to merge cells of excel through excel buffer table. we know that we can call merge only after "RecExcel.CreateSheet".
Thats is where i think warning occurs.
Is there is any better way to handle it.
Hello vijay,
write a function in excelbuffer table,
See the bellow screenshot. it works fine.
André Arnaud de Cal...
293,296
Super User 2025 Season 1
Martin Dráb
232,093
Most Valuable Professional
nmaenpaa
101,156
Moderator