Solved

Merge Cells in Excel 97

Posted on 2002-06-18
6
571 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
excel VBA sending mail 9 54
The blinking Office button 4 43
Retrieve Windows Office Files from Parallels 12 VM 9 70
Microsoft Licensing Questions 7 36
Introduction Perhaps more familiar to developers who primarily use VBScript than to developers who tend to work only with Microsoft Office and Visual Basic for Applications (VBA), the Dictionary is a powerful and versatile class, and is useful …
Some time ago I was asked to create a VBA function that would calculate a check digit for an input number, using the following procedure: First, sum up all the individual digits in the number If that sum value has more than one digit, then sum up …
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

806 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