Solved

Merge Cells in Excel 97

Posted on 2002-06-18
6
565 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel - Clone tables or sheet to another work book. 19 96
Microsoft OneNote 2010 Printer Missing 2 61
Word - Access 3 49
VBA excel copy code causing excel to crash 3 37
Problem: You created a new custom form in Outlook for your contacts (added fields, deleted fields, changed the layout of fields, whatever) and made it the default form for contacts. The good news is that all new contacts will utilize the new form. T…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
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 …

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now