View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Russell Hauf[_2_] Russell Hauf[_2_] is offline
external usenet poster
 
Posts: 1
Default Setting number format on range of cells

Depends on how you are calling this function (what arguments you are
supplying)...

"Neils Christoffersen" wrote:

I have the following VBScript function to set the NumberFormat on a Range.
It appears instead to be setting the NumberFormat for all cells in the Sheet.
Can anyone explain what I'm doing wrong? (Using Excell 2002)

Private Sub setCellRangeNumberFormat (intBeginRow, intBeginColumn,
intEndRow, intEndColumn, strNumberFormat)
m_objExcelApp.Range ( _
m_objExcelApp.Cells(intBeginRow, intBeginColumn), _
m_objExcelApp.Cells(intEndRow, intEndColumn) _
).Style.NumberFormat = strNumberFormat
End Sub

Thanks!