LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Copy Range and Assign a Defined Name to the Pasted Range


This code is self explanitory

Sub CopyandDefine()

Set SourceRange = Sheets("Sheet1").Range("A1:C3")
Set DestStart = Sheets("Sheet2").Range("B30")

SourceRows = SourceRange.Rows.Count
SourceCols = SourceRange.Columns.Count

Set DestEnd = DestStart.Offset(SourceRows - 1, SourceCols - 1)
Set DestRange = Range(DestStart, DestEnd)

DestString = DestRange.Address(external:=True, ReferenceStyle:=xlR1C1)

ActiveWorkbook.Names.Add Name:="joel", RefersToR1C1:="=" & DestString

End Sub


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=159845

Microsoft Office Help

 
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 formulas in defined range VLOOKUP fORMULA Excel Programming 4 June 15th 09 09:32 AM
Copy formulas in defined range Per Jessen Excel Programming 0 June 15th 09 09:10 AM
Copy pasted name range pgarcia Excel Programming 3 February 15th 08 11:56 PM
Name defined Range - Copy? John Buckley Excel Discussion (Misc queries) 1 August 1st 06 02:36 AM
How to: User Form to assign a user defined range to a macro variab TrevTrav Excel Programming 1 March 22nd 05 07:57 PM


All times are GMT +1. The time now is 09:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"