Wednesday, December 3, 2014

Copy data from one named range to another location in excel using VBA

In VBA use this code:

Names("DefinedName").RefersToRange.Cells.Copy Sheets("sheet2").Range("a1")

wherein DefinedName is your name for which data to be copied..
shee2 is sheet name to which data tobe copied
a1 is destination cell in sheet2.

'For copying data from one named cells to another
    sName.RefersToRange.Cells.Copy (dName.RefersToRange.Cells)

'For copying data from named cells to range
    sName.RefersToRange.Cells.Copy dCells

No comments:

Post a Comment