Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default App.screenupdating

Is there any way I can prevent the screen from updating/"blipping" when I
run code? I thought application.screenupdating=false would do it. But my
code below adds a new workbook, copies some data to it, manipulates it, etc.
And as it is doing that, my screen "blips", and I have App.screenupdating
set to false. Is there a way to maybe set focus to the main worksheet so
the end user won't see and blips of the new workbook being added and
manipulated?

Sub Preparetxt()

Dim ans As String
Dim c As Range
Dim iLastRow As Long
Dim iLastRowPO As Long
Dim iLastCol As Long
Dim iCol As Long
Dim cCols As Long
Dim i As Long, j As Long
Dim fAll As Boolean
Dim sTemp

Application.ScreenUpdating = False

Worksheets("HR DB").Range("A5:BJ" & Range("B1499").End(xlUp).Row).Copy
Workbooks.Add
ActiveWorkbook.Worksheets(1).Range("A1").PasteSpec ial Paste:=xlPasteValues

'Delete Inactive Status
ans = "Inactive"
With Columns(12)
Do
Set c = .Find(ans, LookIn:=xlValues)
If Not c Is Nothing Then
c.EntireRow.Delete
End If
Loop While Not c Is Nothing
End With

Columns("A:A").Delete Shift:=xlToLeft
Columns("C:C").Cut
Columns("A:A").Insert Shift:=xlToRight
Columns("C:K").Delete Shift:=xlToLeft

iLastRowPO = Workbooks("Contractor Master4.xls").Worksheets("PO
Table").Cells(Rows.Count, "D").End(xlUp).Row
For i = 5 To iLastRowPO
If Not IsEmpty(Workbooks("Contractor Master4.xls").Worksheets("PO
Table").Cells(i, "D")) Then
sTemp = sTemp & "|" & Workbooks("Contractor
Master4.xls").Worksheets("PO Table").Cells(i, "D").Value
End If
Next i

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To iLastRow
fAll = Cells(i, "C").Value = "--All--"
iLastCol = Cells(i, Columns.Count).End(xlToLeft).Column
If fAll Then
For j = 2 To iLastCol
If Cells(i, j).Value < "" Then
Cells(i, 1).Value = Cells(i, 1).Value & "|" & Cells(i,
j).Value
End If
Next j
Cells(i, 1).Value = Cells(i, 1).Value & sTemp
Else
For j = 2 To iLastCol
If Cells(i, j).Value < "" Then
Cells(i, 1).Value = Cells(i, 1).Value & "|" & Cells(i,
j).Value
End If
Next j
End If
cCols = IIf(iLastCol 1, iLastCol - 1, 1)
Cells(i, 2).Resize(, cCols).ClearContents
Next i

Columns("A:A").Replace What:="|--All--", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("A:A").HorizontalAlignment = xlLeft
Application.ScreenUpdating = True
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default App.screenupdating

I use that religiously in my macros, and I've noticed that although it won't
show every single thing that happens, it has never hidden the opening of
other workbooks and still displays them in the taskbar on the bottom of
Windows. You see them open, then you see them close.

Hfly

"Steph" wrote:

Is there any way I can prevent the screen from updating/"blipping" when I
run code? I thought application.screenupdating=false would do it. But my
code below adds a new workbook, copies some data to it, manipulates it, etc.
And as it is doing that, my screen "blips", and I have App.screenupdating
set to false. Is there a way to maybe set focus to the main worksheet so
the end user won't see and blips of the new workbook being added and
manipulated?

Sub Preparetxt()

Dim ans As String
Dim c As Range
Dim iLastRow As Long
Dim iLastRowPO As Long
Dim iLastCol As Long
Dim iCol As Long
Dim cCols As Long
Dim i As Long, j As Long
Dim fAll As Boolean
Dim sTemp

Application.ScreenUpdating = False

Worksheets("HR DB").Range("A5:BJ" & Range("B1499").End(xlUp).Row).Copy
Workbooks.Add
ActiveWorkbook.Worksheets(1).Range("A1").PasteSpec ial Paste:=xlPasteValues

'Delete Inactive Status
ans = "Inactive"
With Columns(12)
Do
Set c = .Find(ans, LookIn:=xlValues)
If Not c Is Nothing Then
c.EntireRow.Delete
End If
Loop While Not c Is Nothing
End With

Columns("A:A").Delete Shift:=xlToLeft
Columns("C:C").Cut
Columns("A:A").Insert Shift:=xlToRight
Columns("C:K").Delete Shift:=xlToLeft

iLastRowPO = Workbooks("Contractor Master4.xls").Worksheets("PO
Table").Cells(Rows.Count, "D").End(xlUp).Row
For i = 5 To iLastRowPO
If Not IsEmpty(Workbooks("Contractor Master4.xls").Worksheets("PO
Table").Cells(i, "D")) Then
sTemp = sTemp & "|" & Workbooks("Contractor
Master4.xls").Worksheets("PO Table").Cells(i, "D").Value
End If
Next i

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To iLastRow
fAll = Cells(i, "C").Value = "--All--"
iLastCol = Cells(i, Columns.Count).End(xlToLeft).Column
If fAll Then
For j = 2 To iLastCol
If Cells(i, j).Value < "" Then
Cells(i, 1).Value = Cells(i, 1).Value & "|" & Cells(i,
j).Value
End If
Next j
Cells(i, 1).Value = Cells(i, 1).Value & sTemp
Else
For j = 2 To iLastCol
If Cells(i, j).Value < "" Then
Cells(i, 1).Value = Cells(i, 1).Value & "|" & Cells(i,
j).Value
End If
Next j
End If
cCols = IIf(iLastCol 1, iLastCol - 1, 1)
Cells(i, 2).Resize(, cCols).ClearContents
Next i

Columns("A:A").Replace What:="|--All--", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("A:A").HorizontalAlignment = xlLeft
Application.ScreenUpdating = True
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default App.screenupdating

Steph,

After
Workbooks.Add

add the line
ActiveWorkbook.Windows(1).visible=false

This should help some.

Alok Joshi
"Steph" wrote:

Is there any way I can prevent the screen from updating/"blipping" when I
run code? I thought application.screenupdating=false would do it. But my
code below adds a new workbook, copies some data to it, manipulates it, etc.
And as it is doing that, my screen "blips", and I have App.screenupdating
set to false. Is there a way to maybe set focus to the main worksheet so
the end user won't see and blips of the new workbook being added and
manipulated?

Sub Preparetxt()

Dim ans As String
Dim c As Range
Dim iLastRow As Long
Dim iLastRowPO As Long
Dim iLastCol As Long
Dim iCol As Long
Dim cCols As Long
Dim i As Long, j As Long
Dim fAll As Boolean
Dim sTemp

Application.ScreenUpdating = False

Worksheets("HR DB").Range("A5:BJ" & Range("B1499").End(xlUp).Row).Copy
Workbooks.Add
ActiveWorkbook.Worksheets(1).Range("A1").PasteSpec ial Paste:=xlPasteValues

'Delete Inactive Status
ans = "Inactive"
With Columns(12)
Do
Set c = .Find(ans, LookIn:=xlValues)
If Not c Is Nothing Then
c.EntireRow.Delete
End If
Loop While Not c Is Nothing
End With

Columns("A:A").Delete Shift:=xlToLeft
Columns("C:C").Cut
Columns("A:A").Insert Shift:=xlToRight
Columns("C:K").Delete Shift:=xlToLeft

iLastRowPO = Workbooks("Contractor Master4.xls").Worksheets("PO
Table").Cells(Rows.Count, "D").End(xlUp).Row
For i = 5 To iLastRowPO
If Not IsEmpty(Workbooks("Contractor Master4.xls").Worksheets("PO
Table").Cells(i, "D")) Then
sTemp = sTemp & "|" & Workbooks("Contractor
Master4.xls").Worksheets("PO Table").Cells(i, "D").Value
End If
Next i

iLastRow = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To iLastRow
fAll = Cells(i, "C").Value = "--All--"
iLastCol = Cells(i, Columns.Count).End(xlToLeft).Column
If fAll Then
For j = 2 To iLastCol
If Cells(i, j).Value < "" Then
Cells(i, 1).Value = Cells(i, 1).Value & "|" & Cells(i,
j).Value
End If
Next j
Cells(i, 1).Value = Cells(i, 1).Value & sTemp
Else
For j = 2 To iLastCol
If Cells(i, j).Value < "" Then
Cells(i, 1).Value = Cells(i, 1).Value & "|" & Cells(i,
j).Value
End If
Next j
End If
cCols = IIf(iLastCol 1, iLastCol - 1, 1)
Cells(i, 2).Resize(, cCols).ClearContents
Next i

Columns("A:A").Replace What:="|--All--", Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Columns("A:A").HorizontalAlignment = xlLeft
Application.ScreenUpdating = True
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
about screenupdating baha Excel Discussion (Misc queries) 0 March 25th 10 06:16 AM
When to use screenupdating? augustus Excel Programming 2 December 12th 04 09:21 PM
Screenupdating Fu Manchu Excel Programming 2 January 11th 04 02:08 PM
ScreenUpdating Problem pjhageman[_8_] Excel Programming 1 January 10th 04 09:15 PM
ScreenUpdating not effective Boaz Michaely Excel Programming 1 November 11th 03 07:50 PM


All times are GMT +1. The time now is 09:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"