• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6078
  • Last Modified:

VB6 and Excel -- how to format a cell in Excel to merge and center from VB6

Hi all

I am running a VB6 program and sending data to an Excel spreadsheet with columns in. For the header though I want to merge and centre the cells so that the title appears centrally across a row.
any help would be very much appreciated!

kind regards
Dawnyanne
0
dawnyanne
Asked:
dawnyanne
  • 2
2 Solutions
 
jparulCommented:
Here's what you need to do:
Assuming that objSheet is the name of Excel object in your VB6 program.
A1:L1 is the range where you want the heading to appear. You can change it to whatever you want.
 

objsheet.range("A1:L1").select
Selection.merge
Selection.HorizontalAlignment = xlCenter

Open in new window

0
 
game-masterCommented:


xlsheet.Range("A7:A9").Merge
xlsheet.Range("A7:A9").HorizontalAlignment = xlCenter
0
 
dawnyanneAuthor Commented:
Thank you so much for your help - worked an absolute treat! Really appreciated it.

thanks again
Dawnyanne
0
 
game-masterCommented:


good morning!
I'm glad i could help..

game-master
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!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now