cpu saving..

N

N+

hi evrybody !! can anybody make this code more economic for my cpu?? (it is
not a big problem, but maybe there is something better)
ty..!! this is part of code of a macro called every 2 seconds..

aWS.Range("H7").Value = aWS.Range("H1").Value
aWS.Range("H7").Copy
aWS.Range("A1").Insert Shift:=xlDown
aWS.Range("H7").Copy
aWS.Range("A1").Insert Shift:=xlDown

aWS.Range("A801").Delete Shift:=xlUp
 
T

Tom Ogilvy

Why do you copy H7 twice and do nothing with it.

Why do you insert two cells, but only delete one cell

what are you trying to do?

Maybe
With aWS
.Range("A1:A799").copy .Range("A2")
.Range("A1,H7").Value = .Range("H1").Value
End With
 
N

N+

hi tom ty for help, there is a noticeable save of cpu and also more
manuevrability when switchin from1 window to other, whene there is a lot of
winows open.

1) i forgot to write the "delete" twice, u have reason..
2) i copy twice because the macro runs evry 2 seconds to save the cpu.. so i
have to shift down twice (to respect "seconds/rows" proportion..have a link
in another page ) .. i can just copy once, having 1 blank cell and 1 filled,
its true (with is a little cpu save)
3)sorry for disturbing you again the original code has a "if then" choice ,
for the base cell..and i can't translate to the new situation..!! help me if
u can , ty!

If aWS.Range("H1").Value = "0" Then
aWS.Range("H7").Copy
aWS.Range("A1").Insert Shift:=xlDown
'aWS.Range("H7").Copy
aWS.Range("A1").Insert Shift:=xlDown
Else
aWS.Range("H7").Value = aWS.Range("H1").Value
aWS.Range("H7").Copy
aWS.Range("A1").Insert Shift:=xlDown
'aWS.Range("H7").Copy
aWS.Range("A1").Insert Shift:=xlDown
End If

aWS.Range("A801").Delete Shift:=xlUp
aWS.Range("A801").Delete Shift:=xlUp
 
N

N+

ty tom i did it placing twice this..
..Range("A1:A799").copy .Range("A2")

ty for teaching that useful way for copy paste, i appreciated very much!!
hope we will meet again
 

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