Thread: EXCEL AND VBA
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Cloe Cloe is offline
external usenet poster
 
Posts: 3
Default EXCEL AND VBA

Thank you Robert.

Something I learnd today :
I recorded a macro "centering a cell" and then looked into the macro code
and could find the VBA code myself :)

Guy


"Robert Bruce" <rob@analytical-dynamicsdotcodotukay wrote in message
...
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