Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RPW RPW is offline
external usenet poster
 
Posts: 52
Default 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
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
Copy/Paste array formulae from the newsgroup MartinW Excel Discussion (Misc queries) 6 March 21st 08 06:55 AM
Cannot Copy/Paste Array Formula tb Excel Worksheet Functions 3 December 13th 07 02:26 AM
Copy Range and Paste to Array of Sheets bobwilson[_21_] Excel Programming 4 April 6th 06 01:23 PM
Why can't you use this VBA w. array & cell value instead of copy paste? Maria J-son Excel Programming 1 August 15th 05 07:33 AM
Need help to Copy and Paste array using macro wira Excel Programming 4 May 11th 05 08:39 AM


All times are GMT +1. The time now is 12:55 AM.

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"