Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default paste named range for each new sheet created

Exsisting sheet (Error Counter) has two named ranges.
Error_Count
Error_Label

How to automatically paste these two ranges to each sheet created in
workbook.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default paste named range for each new sheet created

Copy the following sub into ThisWorkbook module. It will insert the named
ranges in any worksheet that is activated; not just the added worksheets
(which are activaed by default when added). If you want to exclude any
existing worksheets then put an if statement at the start of the sub and exit
the sub if necessary.


Private Sub Workbook_SheetActivate(ByVal Sh As Object)
On Error GoTo Create_Named_Ranges
Sh.Range("Error_Count").Select
Sh.Range("Error_Label").Select
Exit Sub

Create_Named_Ranges:
With ActiveWorkbook.Worksheets(Sh.Name).Names
.Add Name:="Error_Count", _
RefersToR1C1:=Sh.Range("A1")
.Add Name:="Error_Label", _
RefersToR1C1:=Sh.Range("B1")
End With

End Sub


--
Regards,

OssieMac


"J.W. Aldridge" wrote:

Exsisting sheet (Error Counter) has two named ranges.
Error_Count
Error_Label

How to automatically paste these two ranges to each sheet created in
workbook.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default paste named range for each new sheet created

Thanx, but I dont think I was quite clear...

I need the data (formulas & names & formats) within the original named
range on the existing sheet "Error Counter" to be pasted on each sheet
created.
Thanx
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default paste named range for each new sheet created

Thanx again, but found something that works!


Private Sub Workbook_newsheet(ByVal Sh As Object)

Sheets("ERROR COUNTER").Range("A1:I1").Copy Sh.Range("a1")

End Sub
Reply
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
Accessing a macro created named range John Excel Programming 7 February 5th 09 04:12 PM
Finding a named range based on cell value and copy/paste to same sheet? Simon Lloyd[_715_] Excel Programming 1 May 11th 06 11:25 PM
Copy/paste the template whenever new sheet is created Telecommm Excel Programming 2 December 29th 05 05:29 AM
Paste a named range to another range in Excel David Jean Excel Discussion (Misc queries) 2 April 13th 05 02:02 PM
New Named Range Created Each Time Data Imported into Excel via Macro Carroll Rinehart Excel Programming 2 October 28th 04 04:33 PM


All times are GMT +1. The time now is 10:17 AM.

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

About Us

"It's about Microsoft Excel"