EXCEL AND VBA

  • Thread starter Thread starter Cloe
  • Start date Start date
C

Cloe

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


TIA
Guy
 
Cloe said:
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").Range("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
 
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
 

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