View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Robert Gelbmann Robert Gelbmann is offline
external usenet poster
 
Posts: 4
Default Copy data from Single cell to Merged cell

Hi Kamranr?

---"K" wrote ...
Hi all, I have two Sheets. I want to copy data from the single cell
of Sheet1 to Merged cell of Sheet2. I want macro to [...]


MergeArea should solve the main problem:

Sheets("Sheet1").Range("A3").Copy _
Destination:=Sheets("Sheet2").Range("B3").MergeAre a


Basically macro should copy data from Sheet1 cells and paste it in 3
cells below from the target cell starting from cell B3 in Sheet2. I
hope I was able to explain my problem. Can any friend give me help
on
this please. And also what will be the macro if i need to copy data
from Workbook1 to Workbook2 instead of Sheet1 to Sheet2.



'---snip---
Dim rngSource As Range
Dim rngDest As Range
Dim rng As Range

Set rngSource = Sheets("Sheet1").Range("A3:A6")
Set rngDest = Sheets("Sheet2").Range("B3")

For Each rng In rngSource.Cells
rng.Copy Destination:=rngDest.MergeArea
' Finding Cell below the used MergeArea:
Set rngDest = _
rngDest.Offset(RowOffset:=rngDest.MergeArea.Rows.C ount)
Next
'---snip---


Greetings from Vienna, Austria,
-Robert Gelbmann-