Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Justification of Merged Cellx VB to EXCEL 2

Status
Not open for further replies.

ToeJamNEarl

Programmer
Jan 26, 2004
91
US
Hey Guys,

I am programming an application that will be creating an output file in Excel.


I am programming a Function to print a header for this Excel file, and I was wondering what steps are involved to changes the justification of a merged cell (ie: I want to have my merged cell be center justified).

Also, how would one make such a cell bold text?

If anyone can help me out with this I would appreciate it greatly.

Thank you,

-Diran
 
Diran,

You can use the MergeArea property of the range object, for instance
Code:
    With Sheet2
        .Range("A1:B2").Merge
        With .Cells(1, 1).MergeArea
            .VerticalAlignment = xlTop
            .HorizontalAlignment = xlCenter
        End With
    End With
the formatting is on the merge area

:)



Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Skip,

Thanks for the help man, that helped alot. Any idea where I Can get a list of all the avaiable VB excel commands.
 
In Excel VBA Help you can get a view of the Excel Object Model, Also the Object Browser in your VB editor - select the Excel Library and view the Libraries/Classes/Members.

:)

Skip,

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
Appreciate it. Is it normal for the Object Browser to not give alot of Information on the Excel Object Model and it's properties/functions?

I found out how to bold after some fiddling around :)

Thanks again Skip
 
For stuff like you are doing I sometimes find it easier to record a macro while doing the operation (formatting etc.) manually in Excel, then just look at the code.
 
rdroske,

I never thought of doing that. Thank you very much.

Learn something new everyday :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top