View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jan Kronsell Jan Kronsell is offline
external usenet poster
 
Posts: 99
Default Problems with scrrenupdating

I have six macros like this


Sub FindxOgSletCostProdukt()
Dim nr As Long
Dim ncn As Integer

Application.ScreenUpdating = False
Sheets("CostProdukt").Activate

ncn = Sheets("CostProdukt").Range("iv3").End(xlToLeft).C olumn
nr = Sheets("CostProdukt").Range("a65536").End(xlUp).Ro w

For i = nr To 2 Step -1
If UCase(Range("a" & i)) = "X" Then
Range("a" & i).EntireRow.Delete shift:=xlUp
End If
Next i

For h = ncn To 2 Step -1
If UCase(Cells(3, h).Value) = "X" Then
Cells(3, h).EntireColumn.Delete shift:=xlRight
End If
Next h

Application.ScreenUpdating = True

End Sub

The macros are not quite identical as some of them only has the horisontal
part, other the vertical part and others both parts. Also the rownumber in
the Cells(3, h) is not the same, and the column a in If
UCase(Range("a" & i)) = "X" Then can also change.

All six macros has to be run from a command button. I do this with this
code:

Application.ScreenUpdating = False
Call FindxOgSletBeregninger
Call FindxOgSletAfsatteCosts
Call FindxOgSletAfsatteCBs
Call FindxOgSletCostProdukt
Call FindxOgSletCosts
Call FindxOgSletSimulering
Application.ScreenUpdating = True

My problem is, that the screen flimmers, Screepupdating = False is ignored.
I suppose its because of the Sheets(n).Activate. KIf the sheets are not
activated, no deletion takes place though. Is there a way to avoide the
flimmering.

Jan