Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy paste for each cell in an array
I'm trying to copy paste from one worksheet to another via VBA. My first
attempt resulted in an error as soon as a blank cell was encountered. So I came up with the following code. The For...Next and If...Then work fine - the problem is with the copy/paste lines. I'd appreciate the help (and a little explaination so I don't gum it up again the next time). Here's the <snipped code: myAddresses = Array("A12:A35,A37:C48,L12:O48,L49:M56,L58:L59") For RangeCounter = LBound(myAddresses) To UBound(myAddresses) Set BCRange = Nothing On Error Resume Next Set BCRange = wsh1.Range(myAddresses(RangeCounter)) For Each cell In BCRange.Cells If cell.HasFormula = True Then wsh1.Range(myAddresses(RangeCounter)).Range(cell). Copy NewWbk.Worksheets("Basic Components Pricing").Activate wsh2.Range(myAddresses(RangeCounter)).PasteSpecial _ xlPasteFormulas ElseIf cell.Value 0 Then wsh1.Range(myAddresses(RangeCounter)).Range(cell). Copy NewWbk.Worksheets("Basic Components Pricing").Activate wsh2.Range(myAddresses(RangeCounter)).Range _(cell).PasteSpecial xlPasteValues Else End If Next cell Next RangeCounter -- rpw |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy/Paste array formulae from the newsgroup | Excel Discussion (Misc queries) | |||
Cannot Copy/Paste Array Formula | Excel Worksheet Functions | |||
Copy Range and Paste to Array of Sheets | Excel Programming | |||
Why can't you use this VBA w. array & cell value instead of copy paste? | Excel Programming | |||
Need help to Copy and Paste array using macro | Excel Programming |