View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Memphis Memphis is offline
external usenet poster
 
Posts: 32
Default Copy different cells from Datawrksht to wrksht1 and wrksht2

Thank you mdmckillop for the code, it allowed me to see that what I want to
do is possible.
I have come to realize that when I run this code, the cells I copy from
Sheet2 are then pasted over to sheets 3 and 4 as intended, but when this
happens they get rid of the cells borders that exist in Sheets 3 and 4. Also
some of the cells I am pasting the copied cells into are merged cells, so I
get an error " RUN TIME ERROR '1004':
Cannot Change Part of Merged Cell"
I would like to keep my merged cells and the existing borders in sheets 3
and 4.

Here is the code I have, i have four sheets 1 through 4 sheet one houses the
cmd button only, sheet 2 houses the case information, sheets 3 and 4 receive
the information found in sheet 2.
_____________________________________________
Private Sub CopyData_Click()
Dim Ax(3, 2)
Dim Bx(5, 4)

Dim i As Long
Dim Xi As Long

'Source Target
Ax(1, 1) = "A2": Ax(1, 2) = "B3"
Ax(2, 1) = "B2": Ax(2, 2) = "B5"
Ax(3, 1) = "C2": Ax(3, 2) = "B8"
'Source Target
Bx(4, 3) = "F2": Bx(4, 4) = "B4"
Bx(5, 3) = "G2": Bx(5, 4) = "B6"

For i = 1 To 3
For Xi = 4 To 5

Sheets("Sheet2").Range(Ax(i, 1)).Copy Sheets("Sheet3").Range(Ax(i, 2))
Sheets("Sheet2").Range(Bx(Xi, 3)).Copy Sheets("Sheet4").Range(Bx(Xi, 4))
Next
Sheets("Sheet3").Select
Next
Sheets("Sheet4").Select

Sheets(Array("Sheet3", "Sheet4")).Copy

'ActiveWorkbook.SaveAs ("C:\AAA\BogusFileName.xls")
'ActiveWorkbook.Close
End Sub
__________________________________________________ ____

Thank you for your help in advance.

Memphis