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

Under Pressure back online again looking for support.

I have a small spreadsheet, 42 rows and 14 columns,with about 20 rows (195
cells in total) of conditional formats, 6 graphics,lots of text, numbers and
formulae.

This forms a template that I need to copy 300 times so that data from a
second spreadsheet can populate it. I have written a macro to do this.

Something must be wrong because it takes far too long - to even copy half a
dozen or so. I can use my mouse to copy and paste it faster.

I've done the usual things like turn the autocalculate off and screen update
off.

My macro copies the first 42 lines and then uses a simple loop to paste it
in the appropriate place under the original 42 lines.

Any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,440
Default macro speeds

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote in message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about 20 rows (195
| cells in total) of conditional formats, 6 graphics,lots of text, numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that data from a
| second spreadsheet can populate it. I have written a macro to do this.
|
| Something must be wrong because it takes far too long - to even copy half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and screen update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop to paste it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default macro speeds

Thanks, Niek

here it is !!!!!!

Application.ScreenUpdating = False

Sheets("Sheet1").Select
Range("a1").Select
Rows("1:42").Select
Range("A42").Activate
Selection.Copy

i = o
Do Until i = 3
i = i + 1

Range("a1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveSheet.Paste
Range("A1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell

Loop

"Niek Otten" wrote:

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote in message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about 20 rows (195
| cells in total) of conditional formats, 6 graphics,lots of text, numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that data from a
| second spreadsheet can populate it. I have written a macro to do this.
|
| Something must be wrong because it takes far too long - to even copy half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and screen update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop to paste it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default macro speeds

Niek
Already posted the code.

Want to look at the spreadsheet?

If so, how do I post it?

Thanks agaon

Under Pressure


"Niek Otten" wrote:

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote in message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about 20 rows (195
| cells in total) of conditional formats, 6 graphics,lots of text, numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that data from a
| second spreadsheet can populate it. I have written a macro to do this.
|
| Something must be wrong because it takes far too long - to even copy half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and screen update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop to paste it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default macro speeds

try this in a REGULAR module. Notice the dots required for the WITH
statement

Sub copyit1()
ActiveSheet.ResetAllPageBreaks
With Sheets("sheet1")
For i = 1 To 3
.Rows("1:42").Copy .Cells(i * 42, "a")
ActiveWindow.SelectedSheets.HPageBreaks. _
Add Befo=.Cells(i * 42, "a")
Next i
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in message
...
Thanks, Niek

here it is !!!!!!

Application.ScreenUpdating = False

Sheets("Sheet1").Select
Range("a1").Select
Rows("1:42").Select
Range("A42").Activate
Selection.Copy

i = o
Do Until i = 3
i = i + 1

Range("a1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveSheet.Paste
Range("A1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell

Loop

"Niek Otten" wrote:

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote in
message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about 20 rows
(195
| cells in total) of conditional formats, 6 graphics,lots of text,
numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that data from a
| second spreadsheet can populate it. I have written a macro to do this.
|
| Something must be wrong because it takes far too long - to even copy
half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and screen
update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop to paste
it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default macro speeds

Your problem is the "i=o" - you've got the letter o and not the number 0. It
could be treating i as a string, and appending 1 to the string, so after a
few loops it will be o111111111111111111, and never 3.

"Under Pressure" wrote:

Thanks, Niek

here it is !!!!!!

Application.ScreenUpdating = False

Sheets("Sheet1").Select
Range("a1").Select
Rows("1:42").Select
Range("A42").Activate
Selection.Copy

i = o
Do Until i = 3
i = i + 1

Range("a1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveSheet.Paste
Range("A1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell

Loop

"Niek Otten" wrote:

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote in message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about 20 rows (195
| cells in total) of conditional formats, 6 graphics,lots of text, numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that data from a
| second spreadsheet can populate it. I have written a macro to do this.
|
| Something must be wrong because it takes far too long - to even copy half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and screen update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop to paste it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default macro speeds

Sam

Rather stupid of me, eh?

However, it didn't help. Presumably it assumed that letter'o' had the value
0 as the macro is run. Hence setting variable I to zero.

Macro is still incredibly slow - can't think why. It's only copying 42
lines. Even when I step through the macro one line at a time it pauses for
ages on the paste line.

Any more suggestions?

Under Pressure


"Sam Wilson" wrote:

Your problem is the "i=o" - you've got the letter o and not the number 0. It
could be treating i as a string, and appending 1 to the string, so after a
few loops it will be o111111111111111111, and never 3.

"Under Pressure" wrote:

Thanks, Niek

here it is !!!!!!

Application.ScreenUpdating = False

Sheets("Sheet1").Select
Range("a1").Select
Rows("1:42").Select
Range("A42").Activate
Selection.Copy

i = o
Do Until i = 3
i = i + 1

Range("a1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveSheet.Paste
Range("A1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell

Loop

"Niek Otten" wrote:

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote in message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about 20 rows (195
| cells in total) of conditional formats, 6 graphics,lots of text, numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that data from a
| second spreadsheet can populate it. I have written a macro to do this.
|
| Something must be wrong because it takes far too long - to even copy half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and screen update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop to paste it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default macro speeds

Thanks Don

I'd like to try this but not sure how to.

Do I type it as a macro?

What is the difference between the working of your code and my original?

Cheers.

Under Pressure


"Don Guillett" wrote:

try this in a REGULAR module. Notice the dots required for the WITH
statement

Sub copyit1()
ActiveSheet.ResetAllPageBreaks
With Sheets("sheet1")
For i = 1 To 3
.Rows("1:42").Copy .Cells(i * 42, "a")
ActiveWindow.SelectedSheets.HPageBreaks. _
Add Befo=.Cells(i * 42, "a")
Next i
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in message
...
Thanks, Niek

here it is !!!!!!

Application.ScreenUpdating = False

Sheets("Sheet1").Select
Range("a1").Select
Rows("1:42").Select
Range("A42").Activate
Selection.Copy

i = o
Do Until i = 3
i = i + 1

Range("a1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveSheet.Paste
Range("A1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell

Loop

"Niek Otten" wrote:

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote in
message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about 20 rows
(195
| cells in total) of conditional formats, 6 graphics,lots of text,
numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that data from a
| second spreadsheet can populate it. I have written a macro to do this.
|
| Something must be wrong because it takes far too long - to even copy
half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and screen
update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop to paste
it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?





  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default macro speeds


Please do not type it in. Copy from here and paste. Then fire from the
active sheet.
If all else fails, send your workbook to my address below. But, try first.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in message
...
Thanks Don

I'd like to try this but not sure how to.

Do I type it as a macro?

What is the difference between the working of your code and my original?

Cheers.

Under Pressure


"Don Guillett" wrote:

try this in a REGULAR module. Notice the dots required for the WITH
statement

Sub copyit1()
ActiveSheet.ResetAllPageBreaks
With Sheets("sheet1")
For i = 1 To 3
.Rows("1:42").Copy .Cells(i * 42, "a")
ActiveWindow.SelectedSheets.HPageBreaks. _
Add Befo=.Cells(i * 42, "a")
Next i
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in
message
...
Thanks, Niek

here it is !!!!!!

Application.ScreenUpdating = False

Sheets("Sheet1").Select
Range("a1").Select
Rows("1:42").Select
Range("A42").Activate
Selection.Copy

i = o
Do Until i = 3
i = i + 1

Range("a1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveSheet.Paste
Range("A1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell

Loop

"Niek Otten" wrote:

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote in
message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about 20
rows
(195
| cells in total) of conditional formats, 6 graphics,lots of text,
numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that data
from a
| second spreadsheet can populate it. I have written a macro to do
this.
|
| Something must be wrong because it takes far too long - to even copy
half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and
screen
update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop to
paste
it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?






  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default macro speeds

Thanks for the speedy response - much appreciated.

Sorry to say that it didn't work - after a while got the message 'not
respnding' and had to exit.

Thanks for the offer of having a look at it, very kind of you.

Best wishes

Under Pressure


"Don Guillett" wrote:


Please do not type it in. Copy from here and paste. Then fire from the
active sheet.
If all else fails, send your workbook to my address below. But, try first.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in message
...
Thanks Don

I'd like to try this but not sure how to.

Do I type it as a macro?

What is the difference between the working of your code and my original?

Cheers.

Under Pressure


"Don Guillett" wrote:

try this in a REGULAR module. Notice the dots required for the WITH
statement

Sub copyit1()
ActiveSheet.ResetAllPageBreaks
With Sheets("sheet1")
For i = 1 To 3
.Rows("1:42").Copy .Cells(i * 42, "a")
ActiveWindow.SelectedSheets.HPageBreaks. _
Add Befo=.Cells(i * 42, "a")
Next i
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in
message
...
Thanks, Niek

here it is !!!!!!

Application.ScreenUpdating = False

Sheets("Sheet1").Select
Range("a1").Select
Rows("1:42").Select
Range("A42").Activate
Selection.Copy

i = o
Do Until i = 3
i = i + 1

Range("a1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveSheet.Paste
Range("A1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell

Loop

"Niek Otten" wrote:

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote in
message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about 20
rows
(195
| cells in total) of conditional formats, 6 graphics,lots of text,
numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that data
from a
| second spreadsheet can populate it. I have written a macro to do
this.
|
| Something must be wrong because it takes far too long - to even copy
half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and
screen
update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop to
paste
it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?









  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default macro speeds

Don

I' ve done some more work on this problem.

It's nothing to do with the macro.

I've tried simple copy and paste - both copying the 42 rows and just the
range a1:m42 - makes no difference - very slow indeed.

In fact, once it copies about 60 times, it runs out of memory.

I managed to save it after a copy of 30 and the file size was 24Gb.

Any idea what's going on?

Thanks again

Under Pressure


"Don Guillett" wrote:


Please do not type it in. Copy from here and paste. Then fire from the
active sheet.
If all else fails, send your workbook to my address below. But, try first.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in message
...
Thanks Don

I'd like to try this but not sure how to.

Do I type it as a macro?

What is the difference between the working of your code and my original?

Cheers.

Under Pressure


"Don Guillett" wrote:

try this in a REGULAR module. Notice the dots required for the WITH
statement

Sub copyit1()
ActiveSheet.ResetAllPageBreaks
With Sheets("sheet1")
For i = 1 To 3
.Rows("1:42").Copy .Cells(i * 42, "a")
ActiveWindow.SelectedSheets.HPageBreaks. _
Add Befo=.Cells(i * 42, "a")
Next i
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in
message
...
Thanks, Niek

here it is !!!!!!

Application.ScreenUpdating = False

Sheets("Sheet1").Select
Range("a1").Select
Rows("1:42").Select
Range("A42").Activate
Selection.Copy

i = o
Do Until i = 3
i = i + 1

Range("a1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveSheet.Paste
Range("A1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell

Loop

"Niek Otten" wrote:

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote in
message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about 20
rows
(195
| cells in total) of conditional formats, 6 graphics,lots of text,
numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that data
from a
| second spreadsheet can populate it. I have written a macro to do
this.
|
| Something must be wrong because it takes far too long - to even copy
half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and
screen
update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop to
paste
it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?







  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default macro speeds


That form takes a ton of memory. The macro that I gave you would do it as
desired but for that. I've been trying to tell you that it will NOT work
that way. You must do as I suggested by having ONE form that you fill and
copy to a database sheet and another macro to bring the data(s) back for
work and printing.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in message
...
Don

I' ve done some more work on this problem.

It's nothing to do with the macro.

I've tried simple copy and paste - both copying the 42 rows and just the
range a1:m42 - makes no difference - very slow indeed.

In fact, once it copies about 60 times, it runs out of memory.

I managed to save it after a copy of 30 and the file size was 24Gb.

Any idea what's going on?

Thanks again

Under Pressure


"Don Guillett" wrote:


Please do not type it in. Copy from here and paste. Then fire from the
active sheet.
If all else fails, send your workbook to my address below. But, try
first.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in
message
...
Thanks Don

I'd like to try this but not sure how to.

Do I type it as a macro?

What is the difference between the working of your code and my
original?

Cheers.

Under Pressure


"Don Guillett" wrote:

try this in a REGULAR module. Notice the dots required for the WITH
statement

Sub copyit1()
ActiveSheet.ResetAllPageBreaks
With Sheets("sheet1")
For i = 1 To 3
.Rows("1:42").Copy .Cells(i * 42, "a")
ActiveWindow.SelectedSheets.HPageBreaks. _
Add Befo=.Cells(i * 42, "a")
Next i
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in
message
...
Thanks, Niek

here it is !!!!!!

Application.ScreenUpdating = False

Sheets("Sheet1").Select
Range("a1").Select
Rows("1:42").Select
Range("A42").Activate
Selection.Copy

i = o
Do Until i = 3
i = i + 1

Range("a1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveSheet.Paste
Range("A1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell

Loop

"Niek Otten" wrote:

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote in
message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about 20
rows
(195
| cells in total) of conditional formats, 6 graphics,lots of text,
numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that data
from a
| second spreadsheet can populate it. I have written a macro to do
this.
|
| Something must be wrong because it takes far too long - to even
copy
half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and
screen
update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop to
paste
it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?








  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default macro speeds

Don, thanks

I think that one of your replies to me has gone missing. I don't remeber
you suggesting "You must do as I suggested by having ONE form that you fill
and copy to a database sheet and another macro to bring the data(s) back for
work and printing." I'll have a go at this and if all else fails I can the
work in batches of 30 - just means that I have to hang around while its
doing it.

Thanks again

Under Pressure

"Don Guillett" wrote:


That form takes a ton of memory. The macro that I gave you would do it as
desired but for that. I've been trying to tell you that it will NOT work
that way. You must do as I suggested by having ONE form that you fill and
copy to a database sheet and another macro to bring the data(s) back for
work and printing.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in message
...
Don

I' ve done some more work on this problem.

It's nothing to do with the macro.

I've tried simple copy and paste - both copying the 42 rows and just the
range a1:m42 - makes no difference - very slow indeed.

In fact, once it copies about 60 times, it runs out of memory.

I managed to save it after a copy of 30 and the file size was 24Gb.

Any idea what's going on?

Thanks again

Under Pressure


"Don Guillett" wrote:


Please do not type it in. Copy from here and paste. Then fire from the
active sheet.
If all else fails, send your workbook to my address below. But, try
first.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in
message
...
Thanks Don

I'd like to try this but not sure how to.

Do I type it as a macro?

What is the difference between the working of your code and my
original?

Cheers.

Under Pressure


"Don Guillett" wrote:

try this in a REGULAR module. Notice the dots required for the WITH
statement

Sub copyit1()
ActiveSheet.ResetAllPageBreaks
With Sheets("sheet1")
For i = 1 To 3
.Rows("1:42").Copy .Cells(i * 42, "a")
ActiveWindow.SelectedSheets.HPageBreaks. _
Add Befo=.Cells(i * 42, "a")
Next i
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in
message
...
Thanks, Niek

here it is !!!!!!

Application.ScreenUpdating = False

Sheets("Sheet1").Select
Range("a1").Select
Rows("1:42").Select
Range("A42").Activate
Selection.Copy

i = o
Do Until i = 3
i = i + 1

Range("a1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveSheet.Paste
Range("A1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell

Loop

"Niek Otten" wrote:

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote in
message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about 20
rows
(195
| cells in total) of conditional formats, 6 graphics,lots of text,
numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that data
from a
| second spreadsheet can populate it. I have written a macro to do
this.
|
| Something must be wrong because it takes far too long - to even
copy
half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and
screen
update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop to
paste
it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?









  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default macro speeds

Look at the private emails I sent to you. If you didn't get them, send me a
private email and I will respond. What you are trying to do will not work
and, even if it would, is a BAD idea.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in message
...
Don, thanks

I think that one of your replies to me has gone missing. I don't remeber
you suggesting "You must do as I suggested by having ONE form that you
fill
and copy to a database sheet and another macro to bring the data(s) back
for
work and printing." I'll have a go at this and if all else fails I can
the
work in batches of 30 - just means that I have to hang around while its
doing it.

Thanks again

Under Pressure

"Don Guillett" wrote:


That form takes a ton of memory. The macro that I gave you would do it as
desired but for that. I've been trying to tell you that it will NOT work
that way. You must do as I suggested by having ONE form that you fill and
copy to a database sheet and another macro to bring the data(s) back for
work and printing.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in
message
...
Don

I' ve done some more work on this problem.

It's nothing to do with the macro.

I've tried simple copy and paste - both copying the 42 rows and just
the
range a1:m42 - makes no difference - very slow indeed.

In fact, once it copies about 60 times, it runs out of memory.

I managed to save it after a copy of 30 and the file size was 24Gb.

Any idea what's going on?

Thanks again

Under Pressure


"Don Guillett" wrote:


Please do not type it in. Copy from here and paste. Then fire from the
active sheet.
If all else fails, send your workbook to my address below. But, try
first.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in
message
...
Thanks Don

I'd like to try this but not sure how to.

Do I type it as a macro?

What is the difference between the working of your code and my
original?

Cheers.

Under Pressure


"Don Guillett" wrote:

try this in a REGULAR module. Notice the dots required for the WITH
statement

Sub copyit1()
ActiveSheet.ResetAllPageBreaks
With Sheets("sheet1")
For i = 1 To 3
.Rows("1:42").Copy .Cells(i * 42, "a")
ActiveWindow.SelectedSheets.HPageBreaks. _
Add Befo=.Cells(i * 42, "a")
Next i
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Under Pressure" wrote in
message
...
Thanks, Niek

here it is !!!!!!

Application.ScreenUpdating = False

Sheets("Sheet1").Select
Range("a1").Select
Rows("1:42").Select
Range("A42").Activate
Selection.Copy

i = o
Do Until i = 3
i = i + 1

Range("a1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveSheet.Paste
Range("A1").Select
ActiveCell.Offset(42 * i, 0).Select
ActiveWindow.SelectedSheets.HPageBreaks.Add Befo=ActiveCell

Loop

"Niek Otten" wrote:

Post the code of your macro

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"Under Pressure" wrote
in
message
...
| Under Pressure back online again looking for support.
|
| I have a small spreadsheet, 42 rows and 14 columns,with about
20
rows
(195
| cells in total) of conditional formats, 6 graphics,lots of
text,
numbers and
| formulae.
|
| This forms a template that I need to copy 300 times so that
data
from a
| second spreadsheet can populate it. I have written a macro to
do
this.
|
| Something must be wrong because it takes far too long - to
even
copy
half a
| dozen or so. I can use my mouse to copy and paste it faster.
|
| I've done the usual things like turn the autocalculate off and
screen
update
| off.
|
| My macro copies the first 42 lines and then uses a simple loop
to
paste
it
| in the appropriate place under the original 42 lines.
|
| Any suggestions?










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
Macro Speeds in Vista OS vs XP OS Adam Excel Programming 7 May 17th 07 06:45 AM
calculating speeds in mph Jock W Excel Worksheet Functions 8 July 2nd 06 12:23 PM
Slow Calculation speeds in big spreadsheet MichaelC Excel Worksheet Functions 1 March 16th 06 08:47 PM
Why doesMacro speeds up when I hit ESC? ExcelMonkey Excel Programming 1 August 26th 05 06:24 PM
Macro speeds in 95 vs 98 vs 2000 KD[_3_] Excel Programming 1 January 13th 04 12:12 PM


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

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"