Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 15th, 2004, 05:38 AM
Registered User
 
Join Date: Dec 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default merging excel cells in vb

hi all,
I would like to get some help from the pros. I am currently trying to write a form in MS Excel format with VB. Inside the form, i have cells that contain text and variables. When execute, it will display the form in MS excel format. My problem is i don't know how to merge some particular cells together. I have tried something like this..
<Range(cells(1,2), cells(1,3))Merge> or < MergeCells = true>
But not thing is working. I am a beginner in VB, i hope i have explained this well enough.
Thanks

 
Old December 30th, 2004, 04:48 PM
mls mls is offline
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I was able to use the following to merge Excell cells from VB6, hope it helps.

      mxlSheet.Range(mxlSheet.Cells(1, p), mxlSheet.Cells(1, i)).MergeCells = True
      mxlSheet.Range(mxlSheet.Cells(1, p), mxlSheet.Cells(1, i)).HorizontalAlignment = xlCenter
      mxlSheet.Range(mxlSheet.Cells(1, p), mxlSheet.Cells(1, i)).font.bold = True
      mxlSheet.Range(mxlSheet.Cells(1, p), mxlSheet.Cells(1, i)) = Name

p and i are integers that I set above.

Good Luck






Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting Cells In Flexgrid and Merging rfstuck Pro VB 6 0 April 10th, 2008 10:17 AM
Datagrid-Merging Cells p330418 ASP.NET 2.0 Professional 0 February 29th, 2008 12:06 AM
Merging cells in Datagrid p330418 ASP.NET 2.0 Basics 0 February 28th, 2008 11:21 PM
merging excel cells anoopkpanicker Beginning VB 6 1 March 26th, 2007 05:11 PM
How to know cells in table is merging?? DorisTan VB How-To 0 January 13th, 2005 09:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.