LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Macro to Copy & Paste in backgorund

Why would you want the screen to not update?

All you're doing is hiding and unhiding rows based on content of some cells.

No jumping around happening.

If you do add the two lines you are saying Excel crashes or the code blows
up?

Doesn't for me when I add them as such. But they are not necessary IMO.

Private Sub Worksheet_Calculate()
Const MyCells As String = "c7,b48,b49,b50,b51,b54,b55,b56" 'adjust the
'range to suit
On Error GoTo stoppit
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
For Each cell In Me.Range(MyCells)
With cell
If .Value = "" Then
.EntireRow.Hidden = True
Else
.EntireRow.Hidden = False
End If
End With
Next
stoppit:
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
End Sub


Gord Dibben MS Excel MVP


On Thu, 8 Jan 2009 11:57:00 -0800, TG wrote:

Hello DS NTE,
How can I make your code:
Application.Screenupdating = False
Your code
Application.Screenupdating = True

work with:
Private Sub Worksheet_Calculate()
Const MyCells As String = "c7,b48,b49,b50,b51,b54,b55,b56" 'adjust the
range to suit
On Error GoTo stoppit
Application.EnableEvents = False
For Each cell In Me.Range(MyCells)
With cell
If .Value = "" Then
.EntireRow.Hidden = True
Else
.EntireRow.Hidden = False
End If
End With
Next
stoppit:
Application.EnableEvents = True
End Sub

So it doesnt blow up????
Thank you.
TG



"DS NTE" wrote:

To avoid flickering:

Application.Screenupdating = False
Your code
Application.Screenupdating = True


hth
knut
"Alarmbloke" skrev i melding
...
Hello again,

I currently have a few macros which copy and paste data from one sheet to
another.

When the run you see the sheets flicking between each other as the macro
selects the active sheet, copies the selected range, then selects the
destination sheet pastes etc etc.

This all works as it should but is there a way of doing it in the
background
whilst the user just sees the main input sheet and not flicking pages.

This would seriously help with saving my eye sight

Messy(Macro) as below

Sub transfer()
'
' transfer Macro
'
'

'
Range("H11").Select
Selection.Copy
Sheets("Quote").Select
Range("B48:M48").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("H12").Select
Selection.Copy
Sheets("Quote").Select
Range("B50:M50").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("H13").Select
Selection.Copy
Sheets("Quote").Select
Range("B51:M51").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("H14").Select
Selection.Copy
Sheets("Quote").Select
Range("B52:M52").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("H15").Select
Selection.Copy
Sheets("Quote").Select
Range("B53:M53").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("H16").Select
Selection.Copy
Sheets("Quote").Select
Range("B54:M54").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("H17").Select
Selection.Copy
Sheets("Quote").Select
Range("B55:M55").Select
ActiveSheet.Paste
Sheets("Sheet1").Select
Range("H18").Select
Selection.Copy
Sheets("Quote").Select
Range("B56").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Sheets("Quote").Select
Range("N47:U47").Select

End Sub





 
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
Macro help - copy a cell down gjcase Excel Discussion (Misc queries) 3 September 4th 05 05:09 AM
RECORDED MACRO PASTE'S DATE DIFFERENTLY TO MANUAL PASTE Pauldecan Excel Worksheet Functions 0 June 23rd 05 05:45 PM
Copy Paste macro GWB Direct Excel Discussion (Misc queries) 2 May 9th 05 03:31 PM
Can't Copy and Paste between Excel 2003 Workbooks wllee Excel Discussion (Misc queries) 6 March 30th 05 02:59 PM
Macro - Copy - Email John Excel Worksheet Functions 1 March 2nd 05 07:36 PM


All times are GMT +1. The time now is 03:34 AM.

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"