Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Need Help - How do I stop using select


The following code checks for data in the first cell in the row and
then copies and pastes the formulas. This pastes the correct formulas
to a row if data is present.

The problem is, Application.screenupdate=false does not work since
each select command turns it back on.

So, this code is slow. how do I fix this?


i = 16
While Not IsEmpty(Cells(i, 1))

Range ("I15")
Selection.Copy
Cells(i, 9).Select
ActiveSheet.Paste
Range("J15").Select
Selection.Copy
Cells(i, 10).Select
ActiveSheet.Paste
Range("K15").Select
Selection.Copy
Cells(i, 11).Select
ActiveSheet.Paste
i = i + 1
Wend
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,533
Default Need Help - How do I stop using select

Hi

No need to select cells, it is slowing down your code.

Look at this:

i = 16
While Not IsEmpty(Cells(i, 1))
Range("I15").Copy
Cells(i, 9).Select
ActiveSheet.Paste Destination:=Cells(i, 9)
Range("J15").Copy
ActiveSheet.Paste Destination:=Cells(i, 10)
Range("K15").Copy
ActiveSheet.Paste Destination:=Cells(i, 11)
i = i + 1
Wend

Best regards,
Per

"General Specific" skrev i meddelelsen
...

The following code checks for data in the first cell in the row and
then copies and pastes the formulas. This pastes the correct formulas
to a row if data is present.

The problem is, Application.screenupdate=false does not work since
each select command turns it back on.

So, this code is slow. how do I fix this?


i = 16
While Not IsEmpty(Cells(i, 1))

Range ("I15")
Selection.Copy
Cells(i, 9).Select
ActiveSheet.Paste
Range("J15").Select
Selection.Copy
Cells(i, 10).Select
ActiveSheet.Paste
Range("K15").Select
Selection.Copy
Cells(i, 11).Select
ActiveSheet.Paste
i = i + 1
Wend


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 320
Default Need Help - How do I stop using select

First, it's Application.Screenupdating = False

Next:
Application.Calculation = xlCalculationManual
i = 16
While Not IsEmpty(Cells(i, 1))
Range ("I15:K15").Copy Cells(i,9)
i = i + 1
Wend


But even faster (no looping):
Sub DoItAll()
'Untested
Lastrow=Range("A16").end(xlDown).Row
Range("I15:K15").Copy Range("I16").resize(LastRow-15,3)
End Sub

HTH
Bob Umlas
Excel MVP
"General Specific" wrote:


The following code checks for data in the first cell in the row and
then copies and pastes the formulas. This pastes the correct formulas
to a row if data is present.

The problem is, Application.screenupdate=false does not work since
each select command turns it back on.

So, this code is slow. how do I fix this?


i = 16
While Not IsEmpty(Cells(i, 1))

Range ("I15")
Selection.Copy
Cells(i, 9).Select
ActiveSheet.Paste
Range("J15").Select
Selection.Copy
Cells(i, 10).Select
ActiveSheet.Paste
Range("K15").Select
Selection.Copy
Cells(i, 11).Select
ActiveSheet.Paste
i = i + 1
Wend

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Need Help - How do I stop using select

Wow!

Thanks guys!

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
Stop select and copy of excel sheet in protect mode Rakesh[_2_] Excel Programming 0 August 28th 06 09:54 AM
How to stop the 'select sheet' window pop up deepakmehta Excel Programming 2 December 18th 05 10:53 PM
How do I stop other circles in other cells to stop selecting? stauff Excel Worksheet Functions 2 October 29th 04 09:02 PM
How do I stop other circles in other boxes to stop selecting? stauff Excel Worksheet Functions 1 October 28th 04 10:27 PM
Macro: With Stop it works. Without Stop it doesn't. Don Wiss Excel Programming 2 October 12th 04 10:49 AM


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

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

About Us

"It's about Microsoft Excel"