Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Moving a range name AND Contents
Currently MyRng (a named range) refersto: sheet1 - B2:D4
How can I change that in VBA to sheet2 - D5 (D5:F7)? I wish to also include the cells B2:D4 values/contents. How is this done? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Moving a range name AND Contents
hi
something like this might work. note your destination range is larger than your source range????? Sub MoveNamedRange() Dim r As Range Set r = Range("MyRng") Range("MyRng").Copy Destination:= _ Sheets("Sheet2").Range("D5:F7") ActiveWorkbook.Names.Add Name:="MyRng", _ RefersTo:=Sheets("Sheet2").Range("D5:F7") r.ClearContents 'optional End Sub Regards FSt1 "JMay" wrote: Currently MyRng (a named range) refersto: sheet1 - B2:D4 How can I change that in VBA to sheet2 - D5 (D5:F7)? I wish to also include the cells B2:D4 values/contents. How is this done? |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Moving a range name AND Contents
Thanks for the help Fst1, I got it !!
"FSt1" wrote: hi something like this might work. note your destination range is larger than your source range????? Sub MoveNamedRange() Dim r As Range Set r = Range("MyRng") Range("MyRng").Copy Destination:= _ Sheets("Sheet2").Range("D5:F7") ActiveWorkbook.Names.Add Name:="MyRng", _ RefersTo:=Sheets("Sheet2").Range("D5:F7") r.ClearContents 'optional End Sub Regards FSt1 "JMay" wrote: Currently MyRng (a named range) refersto: sheet1 - B2:D4 How can I change that in VBA to sheet2 - D5 (D5:F7)? I wish to also include the cells B2:D4 values/contents. How is this done? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copying and moving column contents along with headings | Excel Worksheet Functions | |||
compare the contents of one range of cells with the contents of a. | Excel Discussion (Misc queries) | |||
sum with moving range | Excel Discussion (Misc queries) | |||
moving the contents of a cell | Excel Worksheet Functions | |||
moving cell contents (automatically) | Excel Discussion (Misc queries) |