Solved

Merge Cells in Excel 97

Posted on 2002-06-18
6
576 Views
Last Modified: 2012-06-27
Hello

I'm using VB to merge cells on an excel sheet:
Let's say there is a row with 6 columns and i merge the first five cells to a large cell:

objSheet.Range(objSheet.Cells(1,2), objSheet.Cells(1,5).MergeCells = True

ThenI write the values in the cells. But If I have a long text in left colspan, this text is truncated after the end of the first cell. But it shouldn't, the cells 1-5 are merged so there is plenty of room in cell2?

¦cell1¦cell2¦cell3¦cell4¦cell5¦cell6¦
 Superdubertext_as_itshouldbe     23
 Super                            23

If I click on the cell (RMB) and the 'Formating Cells' and in the window 'Alignment'. The checkmark 'Merge cells' is only grey.


Any tips?
Alesch
0
Comment
Question by:alesch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 44

Expert Comment

by:bruintje
ID: 7088765
Hi Alesch,

Cells is used as Cells(rowindex, colindex)

so what you're merging here is

objSheet.Cells(1,2), objSheet.Cells(1,5)

row 1 column 2 till row 1 column 5

or four columns of merging done not 1-5 but 2-5

objSheet.Cells(1,1), objSheet.Cells(1,5)

this will merge 1-5

HAGD:O)Bruintje
0
 

Author Comment

by:alesch
ID: 7088845
Ok, this was a type error. Of course :
objSheet.Cells(1,1), objSheet.Cells(1,5).
Thanks

Anyway, In the Excel-Sheet isn't a thin vertical line between cell 1 and 2 like it is between two normal cells. So it looks like the merging worked (but not completely?).

Update: It works in Excel2000

Alesch
0
 
LVL 44

Accepted Solution

by:
bruintje earned 300 total points
ID: 7089085
code like this works for me in xl97

Range(ActiveSheet.Cells(1, 1), ActiveSheet.Cells(1, 5)).MergeCells = True

so i guess there something else going wrong any other code around that merge?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:alesch
ID: 7089892
Hello bruintje

Thanks for your tests. I found the error. As you said, it was in the rest of the code. The array was wrong which I wrote in the complete (merged) row.

Superdupertext_as_it, shouldbe, 23
instead of
Superdupertext_as_itshouldbe, 23

Well, three values won't fit....

Thanks
Alesch
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7089991
glad i could help, but next time instead of giving a C,

which ruins my record that's why i'm always commenting,

ask a 0-point Q in customer support to lower the points on this Q and you can give an A or even get your points all back

Brian
0
 

Author Comment

by:alesch
ID: 7090261
Oukei then........But now i don't have time for that. Let's see the next few days. But I understand you...
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In case Office 2010 has not been deployed in your environment, this article may be quite useful. In our office, we wanted a way to deploy Microsoft Office Professional Plus 2010 through an automated batch file via logon script. This article is docum…
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question