Thanx Nigel
I works fine except for one small detail. When I run the macro for
second time it gives me problems. I think this is becuase I do a fil
function and I have hardcoded the destination fill. Does that mak
sense to you?
Code
-------------------
lastrow = Cells(Rows.Count, "B").End(xlUp).Row
Cells(lastrow + 1, 1) = "TOTAL"
Cells(lastrow + 1, 2).Formula = "=sum(B3:B" & lastrow & ")"
'format totals
Cells(lastrow + 1, 2).Select
Selection.AutoFill Destination:=Range("B156:K156"), Type:=xlFillDefault ' I think the problem is here. I need to have a
variable that will change according to number of rows
Rows("156:156").Select
Selection.Font.Bold = True
With Selection.Font
.Name = "Arial"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("B3:O157").Select
Selection.Replace What:="", Replacement:="0.00", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Range("B:B,D:D,F:F,H:H,J:J,L:L,N:N").Select
Selection.NumberFormat = "0"
Range("C:C,E:E,G:G,I:I,K:K,M:M,O:O").Select
Selection.NumberFormat = "#,##0.00"
-------------------
Thanx agai
--
Message posted from
http://www.ExcelForum.com