LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 1
Default Macro to add new sheet and then fill formula in a totals sheet to refernce this sheet

Hi all,

I have created a macro to copy the template sheet and name the sheet based on the last sheet, so sheet names are 1,2,3 etc

Sheets("TemplateSheet").Copy After:=Sheets(ActiveWorkbook.Sheets.Count)
ActiveSheet.Previous.Select
Range("C6").Copy
ActiveSheet.Next.Select
Range("c6").PasteSpecial xlPasteValues
Range("c6").Value = Range("c6").Value + 1
ActiveSheet.Name = Format(Range("c6").Value, "#")

This works fine but i also want to add to the macro to copy this formula =IF('1'!A$3="","",'1'!A$3) to the next row but to reference the new worksheet so it would be =IF('2'!A$3="","",'2'!A$3). Does anyone know how I can do this?

Thanks
 
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
formula for totals throughout sheet Dottled Excel Discussion (Misc queries) 3 January 26th 09 03:53 PM
Refernce sheet names in if statement Sabosis Excel Programming 4 October 31st 08 06:59 PM
"='sheet 1'!D4" auto fill sheet to sheet ='sheet 2'!D4 mistewalker Excel Worksheet Functions 5 January 6th 08 11:36 PM
counting like items on one sheet, showing totals on another sheet RPW Excel Programming 3 October 6th 06 08:36 PM
Conditionally Fill a sheet row if cell value in another sheet 0 nstx Excel Worksheet Functions 2 November 6th 05 03:04 PM


All times are GMT +1. The time now is 10:13 PM.

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"