Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Generally speaking, which is faster?

I have the following code that selects a bunch of sheets, and then
copies a row and pastes the formula in that row to a set range. This
code takes a while to run. Generally speaking, would a for next loop
be faster? Or is there an even faster way (ie a do while loop?)
Thanks!

Set shtarray = Sheets Array "Sheet1", "Sheet2", "Sheet3", "Sheet4",
"Sheet5", "Sheet6"))

shtarray.Select
Sheets("Sheet1").Activate

'Copy Formula
Range("A2:EC2").Copy

Set frng = Range("A5:EC" & Data.Range("b65536").End(xlUp).Row)

frng.Select
Selection.PasteSpecial Paste:=xlPasteFormulas
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Generally speaking, which is faster?

Steph,

I can't see how this is copying from more than just Sheet1.

Generally speaking, a loop is a loop, Do While, Do Until, For Next, it is
unlikely that any will be faster than another to any significance.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Steph" wrote in message
om...
I have the following code that selects a bunch of sheets, and then
copies a row and pastes the formula in that row to a set range. This
code takes a while to run. Generally speaking, would a for next loop
be faster? Or is there an even faster way (ie a do while loop?)
Thanks!

Set shtarray = Sheets Array "Sheet1", "Sheet2", "Sheet3", "Sheet4",
"Sheet5", "Sheet6"))

shtarray.Select
Sheets("Sheet1").Activate

'Copy Formula
Range("A2:EC2").Copy

Set frng = Range("A5:EC" & Data.Range("b65536").End(xlUp).Row)

frng.Select
Selection.PasteSpecial Paste:=xlPasteFormulas



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Generally speaking, which is faster?

Hi Bob. Thaks for the response. As for my crappy code, it started with the
macro recorder. So code aside, I selected several sheets using the ctl key,
then copied a row with formulas in it (each sheet has a row of formulas in
the same row), then copied it to a range. It works....just slowly.

So that being said, do you think a loop will be faster than my crappy-code
method?

I'm no great coder, so I'm just looking for a bit of reassurance before I
try to tackle the writing of the loop!!

Thanks again!

"Bob Phillips" wrote in message
...
Steph,

I can't see how this is copying from more than just Sheet1.

Generally speaking, a loop is a loop, Do While, Do Until, For Next, it is
unlikely that any will be faster than another to any significance.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Steph" wrote in message
om...
I have the following code that selects a bunch of sheets, and then
copies a row and pastes the formula in that row to a set range. This
code takes a while to run. Generally speaking, would a for next loop
be faster? Or is there an even faster way (ie a do while loop?)
Thanks!

Set shtarray = Sheets Array "Sheet1", "Sheet2", "Sheet3", "Sheet4",
"Sheet5", "Sheet6"))

shtarray.Select
Sheets("Sheet1").Activate

'Copy Formula
Range("A2:EC2").Copy

Set frng = Range("A5:EC" & Data.Range("b65536").End(xlUp).Row)

frng.Select
Selection.PasteSpecial Paste:=xlPasteFormulas





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Generally speaking, which is faster?

Steph,

The point I was making was that I couldn't comment as to whether a loop
would be quicker than your code, as I couldn't see how your code worked
through all the sheets, it only seemed to do one to me.

How does you code process all the sheets?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Steph" wrote in message
...
Hi Bob. Thaks for the response. As for my crappy code, it started with

the
macro recorder. So code aside, I selected several sheets using the ctl

key,
then copied a row with formulas in it (each sheet has a row of formulas in
the same row), then copied it to a range. It works....just slowly.

So that being said, do you think a loop will be faster than my crappy-code
method?

I'm no great coder, so I'm just looking for a bit of reassurance before I
try to tackle the writing of the loop!!

Thanks again!

"Bob Phillips" wrote in message
...
Steph,

I can't see how this is copying from more than just Sheet1.

Generally speaking, a loop is a loop, Do While, Do Until, For Next, it

is
unlikely that any will be faster than another to any significance.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Steph" wrote in message
om...
I have the following code that selects a bunch of sheets, and then
copies a row and pastes the formula in that row to a set range. This
code takes a while to run. Generally speaking, would a for next loop
be faster? Or is there an even faster way (ie a do while loop?)
Thanks!

Set shtarray = Sheets Array "Sheet1", "Sheet2", "Sheet3", "Sheet4",
"Sheet5", "Sheet6"))

shtarray.Select
Sheets("Sheet1").Activate

'Copy Formula
Range("A2:EC2").Copy

Set frng = Range("A5:EC" & Data.Range("b65536").End(xlUp).Row)

frng.Select
Selection.PasteSpecial Paste:=xlPasteFormulas







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 312
Default Generally speaking, which is faster?

Hi Bob. That's odd, it works on all sheets in the array for me. Perhaps I
copied the sample code into the moriginal message incorrectly. I pasted it
again below. Thanks for your time!

Sub Pop_Forecast()

Dim shtarray As Sheets
Dim frng As Range
Dim sh As Worksheet

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Set shtarray = Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4",
"Sheet5", "Sheet6"))

shtarray.Select
Sheets("Sheet1").Activate

'Copy Formula - every sheet has a formula in each cell of this row
Range("A2:EC2").Copy

Set frng = Range("A5:EC" & Data.Range("b65536").End(xlUp).Row)

frng.Select
Selection.PasteSpecial Paste:=xlPasteFormulas

Application.Calculation = xlCalculationAutomatic



"Bob Phillips" wrote in message
...
Steph,

The point I was making was that I couldn't comment as to whether a loop
would be quicker than your code, as I couldn't see how your code worked
through all the sheets, it only seemed to do one to me.

How does you code process all the sheets?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Steph" wrote in message
...
Hi Bob. Thaks for the response. As for my crappy code, it started with

the
macro recorder. So code aside, I selected several sheets using the ctl

key,
then copied a row with formulas in it (each sheet has a row of formulas

in
the same row), then copied it to a range. It works....just slowly.

So that being said, do you think a loop will be faster than my

crappy-code
method?

I'm no great coder, so I'm just looking for a bit of reassurance before

I
try to tackle the writing of the loop!!

Thanks again!

"Bob Phillips" wrote in message
...
Steph,

I can't see how this is copying from more than just Sheet1.

Generally speaking, a loop is a loop, Do While, Do Until, For Next, it

is
unlikely that any will be faster than another to any significance.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Steph" wrote in message
om...
I have the following code that selects a bunch of sheets, and then
copies a row and pastes the formula in that row to a set range.

This
code takes a while to run. Generally speaking, would a for next

loop
be faster? Or is there an even faster way (ie a do while loop?)
Thanks!

Set shtarray = Sheets Array "Sheet1", "Sheet2", "Sheet3", "Sheet4",
"Sheet5", "Sheet6"))

shtarray.Select
Sheets("Sheet1").Activate

'Copy Formula
Range("A2:EC2").Copy

Set frng = Range("A5:EC" & Data.Range("b65536").End(xlUp).Row)

frng.Select
Selection.PasteSpecial Paste:=xlPasteFormulas










  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Generally speaking, which is faster?

Steph,

I actually tested it now, and see what you are doing. As such, I don't think
that a loop will be quicker than the way you are doing it.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Steph" wrote in message
...
Hi Bob. That's odd, it works on all sheets in the array for me. Perhaps

I
copied the sample code into the moriginal message incorrectly. I pasted

it
again below. Thanks for your time!

Sub Pop_Forecast()

Dim shtarray As Sheets
Dim frng As Range
Dim sh As Worksheet

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Set shtarray = Sheets(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4",
"Sheet5", "Sheet6"))

shtarray.Select
Sheets("Sheet1").Activate

'Copy Formula - every sheet has a formula in each cell of this row
Range("A2:EC2").Copy

Set frng = Range("A5:EC" & Data.Range("b65536").End(xlUp).Row)

frng.Select
Selection.PasteSpecial Paste:=xlPasteFormulas

Application.Calculation = xlCalculationAutomatic



"Bob Phillips" wrote in message
...
Steph,

The point I was making was that I couldn't comment as to whether a loop
would be quicker than your code, as I couldn't see how your code worked
through all the sheets, it only seemed to do one to me.

How does you code process all the sheets?

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Steph" wrote in message
...
Hi Bob. Thaks for the response. As for my crappy code, it started

with
the
macro recorder. So code aside, I selected several sheets using the

ctl
key,
then copied a row with formulas in it (each sheet has a row of

formulas
in
the same row), then copied it to a range. It works....just slowly.

So that being said, do you think a loop will be faster than my

crappy-code
method?

I'm no great coder, so I'm just looking for a bit of reassurance

before
I
try to tackle the writing of the loop!!

Thanks again!

"Bob Phillips" wrote in message
...
Steph,

I can't see how this is copying from more than just Sheet1.

Generally speaking, a loop is a loop, Do While, Do Until, For Next,

it
is
unlikely that any will be faster than another to any significance.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Steph" wrote in message
om...
I have the following code that selects a bunch of sheets, and then
copies a row and pastes the formula in that row to a set range.

This
code takes a while to run. Generally speaking, would a for next

loop
be faster? Or is there an even faster way (ie a do while loop?)
Thanks!

Set shtarray = Sheets Array "Sheet1", "Sheet2", "Sheet3",

"Sheet4",
"Sheet5", "Sheet6"))

shtarray.Select
Sheets("Sheet1").Activate

'Copy Formula
Range("A2:EC2").Copy

Set frng = Range("A5:EC" & Data.Range("b65536").End(xlUp).Row)

frng.Select
Selection.PasteSpecial Paste:=xlPasteFormulas










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
category label spacing (x-axis generally) arcibald tuttle Charts and Charting in Excel 2 April 2nd 10 03:47 PM
My computer keeps speaking out cells in excel, no other program K8 Excel Discussion (Misc queries) 1 October 23rd 09 03:45 PM
can this be done faster? Frank Excel Discussion (Misc queries) 7 August 9th 07 10:02 PM
Should I generally request "post a poll" when I post a new thread? Joe Miller Excel Discussion (Misc queries) 2 January 7th 06 04:46 PM
Can faster CPU+larger/faster RAM significantly speed up recalulati jmk_li Excel Discussion (Misc queries) 2 September 28th 05 10:24 AM


All times are GMT +1. The time now is 12:49 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"