Thread: EXCEL AND VBA
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Robert Bruce[_2_] Robert Bruce[_2_] is offline
external usenet poster
 
Posts: 108
Default EXCEL AND VBA

Cloe wrote:
Hi all.
I use VB6 to generate an Excel report.
I have 3 questions:

1. If .NumberFormat ="@" is for text , what is the NumberFormat for
numerical values? (Integer values).

2. How do I make A1:E1 cells to be centered ? (without causing the
whole column to be centered).

3. How do I put text that contains vbCr (return) in a cell ?

e.g.
First Last Phone
Name Name Number

Hi,

These should give you a start. Note that if you're using automation you'll
have to make the object references to the range objects much more explicit -
objXL.workbooks("Book.xls").worksheets("Sheet1").R ange("A1") where objXL is
your Excel application object for example.

Range("E2").NumberFormat = "0"

Range("A1:E1").HorizontalAlignment = Excel.xlCenter

With Range("E1")
.FormulaR1C1 = "Wrapped" & VBA.vbLf & "Text"
.WrapText = True
End With

HTH

Rob