View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
R Avery R Avery is offline
external usenet poster
 
Posts: 220
Default Retrieve variant array of cells as formatted in the cell

excellent. The Text property always returns the value as formatted in
the cell. I was looking for that. Thanks.

Tom Ogilvy wrote:
No, you can't do it in your usual fashion.

You can simplify your function by using the Text property.

Public Function GetCellsAsFormatted(rng As Excel.Range) As Variant
Dim i As Long, j As Long

If rng Is Nothing Then Exit Sub

ReDim GetCellsAsFormatted(1 To rng.Rows.Count, 1 To _
rng.Columns.Count)
For i = LBound(GetCellsAsFormatted, 1) To
UBound(GetCellsAsFormatted, 1)
For j = LBound(GetCellsAsFormatted, 2) To _
UBound(GetCellsAsFormatted, 2)
GetCellsAsFormatted(i, j) = rng(i,j).Text

Next j
Next i
End Function