Centering and warping text

  • Thread starter Thread starter Nils Titley
  • Start date Start date
N

Nils Titley

For my headers on a report I am creating, I need to be able to center
justification and wrap the text. How do I do that in association with this
code or before the code.

ActiveCell.Offset(0, 0).Value = "Date"

Thanks
 
Worksheets("Sheet1").Range("B2").Value = _
"This text should wrap in a cell."
Worksheets("Sheet1").Range("B2").WrapText = True

Worksheets("Sheet1").Range("B2").HorizontalAlignment = xlCenter
 
I appreciate your suggestion but I am not working with Worksheets or Ranges.
Workbooks and ActiveCell.

Isn't there another way to do what I need to do?

Thanks
 
I appreciate your suggestion but I am not working with Worksheets or Ranges.  
Workbooks and ActiveCell.

Isn't there another way to do what I need to do?

Thanks







- Show quoted text -

Isn't the technique the same? Does something like this work?:

Worksheets(ActiveWorkbook).Range(ActiveCell).HorizontalAlignment =
xlCenter


Chris
 
If you are working in Excel, it is pretty hard to not work with worksheets
and ranges, unless you are doing charts. <g> That said, here is some
different syntax that you might be more comfortable with.

ActiveWorkbook.ActiveCell.HorizontalAlignment = xlCenter
ActiveWorkbook.Selection.WrapText = True
 
You can also set these attributes manually in Excel on the Format menu. Just
click Format>Alignment then check wrap text and select your alignment in the
drop down box and click OK. You don't need code for this unless you are
building the sheet format entirely through code.
 
I am a programmer but I have done mostly C, ADA etc with Simulators. I am
helpinig a friend build a macro to process data so I am learning what I need
to know to do what he needs so I am not up to speed.

What cht13er suggested worked and I will try your suggestion.

Thanks for the help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top