Solved

Merge Cells in Excel 97

Posted on 2002-06-18
6
579 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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

707 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