View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Mulit-column number formatting

How about:

Option Explicit
Sub x()

Dim i As Long
dim iCol As Integer

For i = 1 To 47
iCol = 12 + 7 * (i - 1)
activesheet.cells(1,icol).resize(1,2).entirecolumn .NumberFormat = "0.00"
Next i
End Sub

You must be using xl2007 for all those columns, right?

MikeM wrote:

I'm trying to format a sequence of columns, but without success. I've used:

Sub x()

Dim i As Integer, iCol As Integer

For i = 1 To 47
iCol = 12 + 7 * (i - 1)
Range(Cells(, iCol), Cells(, iCol + 2)).NumberFormat = "0.00"
Next i
End Sub

I've tried columns(icol, icol+2) as well. Any ideas?

TIA,
Mike


--

Dave Peterson