Simplify Code for Copy/Paste Special
On Aug 31, 4:39*pm, "Don Guillett" wrote:
*.Range("E29").End(xlDown)).PasteSpecial Paste:=xlPasteValues
Actually should be
.Range(Range("e29"), Range("E29").End(xlDown)).PasteSpecial
Paste:=xlPasteValues
Try this further simplification and correction
Sub sheetsinarray()
myarray = Array("Interest", "Principal")
For Each Sh In myarray
With Sheets(Sh)
* * .Range("E28:DI28").Copy
* * .Range(Range("e29"), Range("E29").End(xlDown)) _
* * * * *.PasteSpecial Paste:=xlPasteValues
* * .Range("G5") = Now 'Date
End With
Next Sh
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Don Guillett" wrote in message
...
Something like this?
Sub update_analysis()
* *Application.ScreenUpdating = False
with Sheets("Interest")
* *.Range("E28:DI28").Copy
* *.Range("E29").End(xlDown)).PasteSpecial Paste:=xlPasteValues
* *.Range("G5")=date
end with
with Sheets("Principal")
* *.Range("E28:DI28").Copy
* *.Range("E29").End(xlDown)).PasteSpecial Paste:=xlPasteValues
* *.range("g5")=date
end with
'shouldn't be necessary
'Sheets("Leasing Analysis").Select
'Range("A2").Select
Application.ScreenUpdating = True
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
"Active VBA" wrote in message
. ..
Is there a way to simplify this code below?
If you could please suggest a revised code, it would be greatly
appreciated. Thanks.
Sub update_analysis()
'
' Macro recorded July 2008
'
'
* *Application.ScreenUpdating = False
* *Sheets("Interest").Select
* *Range("E28:DI28").Select
* *Selection.Copy
* *Range("E29").Select
* *Range(Selection, Selection.End(xlDown)).Select
* *Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
* * * *False, Transpose:=False
* *Application.CutCopyMode = False
* *Selection.Copy
* *Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
* * * *:=False, Transpose:=False
* *Range("G5").Select
* *ActiveCell.FormulaR1C1 = "=NOW()"
* *Selection.Copy
* *Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
* * * *:=False, Transpose:=False
* *Sheets("Principal").Select
* *Range("E28:DI28").Select
* *Selection.Copy
* *Range("E29").Select
* *Range(Selection, Selection.End(xlDown)).Select
* *Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone,
SkipBlanks:= _
* * * *False, Transpose:=False
* *Application.CutCopyMode = False
* *Selection.Copy
* *Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
* * * *:=False, Transpose:=False
* *Range("G5").Select
* *ActiveCell.FormulaR1C1 = "=NOW()"
* *Selection.Copy
* *Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
* * * *:=False, Transpose:=False
* * * * * *Sheets("Leasing Analysis").Select
* *Range("A2").Select
* *Application.ScreenUpdating = True
End Sub
Thank you for your help in advance.
Best regards,
Active VBA
*** Sent via Developersdexhttp://www.developersdex.com***- Hide quoted text -
- Show quoted text -
Code you suggest did not work for some reason.?? Any suggestions.
Thanks, V.
|