View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Socko Socko is offline
external usenet poster
 
Posts: 28
Default Problems with scrrenupdating

You actually dont need to activate a sheet if you want to read, write,
delete any or all contents of the sheet.
I have made small changes to your code, have a look... I would say you
can still optimize the speed of this code execution and along with
that avoid screen flickering. I am sure this helps.

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


Application.ScreenUpdating = False

with Sheets("CostProdukt")
ncn = .Range("iv3").End(xlToLeft).Column
nr = .Range("a65536").End(xlUp).Row


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
end with

Application.ScreenUpdating = True


End Sub

Selva V Pasupathy
for more resources on visual basic and programming,
please visit : http://socko.wordpress.com