selection.numberformat

  • Thread starter Thread starter monika
  • Start date Start date
M

monika

hi...i need to show the user whatever i am doign in my programmign thing. so
i am using the application.screenupdating as true. But whiel doing so its
takign more timebecause i have to change the color and font of the
particualr cell. the way i am dealign isi select the cell and then i change
the font and format...i have sited 2 suh example.s... cani do away with this
thing in a better ways... ?

thanks a lot ..monika

Cells(LNewRng.Row,
m - 1).Select
Selection.Font.Bold = True
With Selection.Interior
.ColorIndex = 34
.Pattern = xlSolid
End With
Cells(LNewRng.Row, m - 1).Value = "Year " & Year(Date) & " Sum"



While k <= LastCellNum
Cells(k, j).Select
Selection.NumberFormat = "#,##0"
Cells(k, j).Value = weeks *(Cells(k,monMatch.Column).Value)
Cells(k, j).Value = "=(" & weeks & "*" &
Cells(k,monMatch.Column).Address & ")"
k = k + 1
Wend
 
Monika
You can get rid of the "Select" in several places to make your code run
faster, but this would have a very insignificant effect on your problem.
The time required to repaint the screen is much more than the time required
to run the macro so I would say to make judicious use of the ScreenUpdating
so that you don't repaint the screen for every change you make. For
instance, change both the font and the color with ScreenUpdating set to
False, then set it to true, rather than have it set to true for each change
and repaint the screen twice. HTH Otto
 
Back
Top