Making the macro's execution faster

D

dspilberg

I would like to know if there is a way to make my macro's execution faster.
It follows that during its execution I work in 2 different worksheets in
parallel. So it shows me in the screen each active sheet every line the macro
runs. I tried occulting the sheets (in which the macro works) but then the
macro did not run. Is there a way to occult the sheet without having problem
with its exectuion?

Is there any other way to make it faster?

I built the simple following macro just to illustrate the problem.

Thanks in advance. I really appreciate any tip or attempt.

Daniel (Brazil)

Sub Macro1()
'
Sheets("Plan1").Select
Range("a1").Select
Range("a1") = "1"
Sheets("Plan2").Select
Range("a1").Select
Range("a1") = "1"
Sheets("Plan1").Select
cont = 0

For a = 1 To 500
ActiveCell = Cells(1, 1).Value + cont
ActiveCell.Offset(1, 0).Select
Sheets("Plan2").Select
ActiveCell = Cells(1, 1).Value + cont
ActiveCell.Offset(1, 0).Select
Sheets("Plan1").Select
cont = cont + 1
Next a

End Sub
 
P

PCLIVE

Try adding to your code.

Application.ScreenUpdating = False '(add to the top of your code)

<Your Code>

Application.ScreenUpdating = True '(add to the bottom of your code)


HTH,
Paul
 
D

dspilberg

It worked!!! Thank you!

"PCLIVE" escreveu:
Try adding to your code.

Application.ScreenUpdating = False '(add to the top of your code)

<Your Code>

Application.ScreenUpdating = True '(add to the bottom of your code)


HTH,
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top