Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run Macro & Rename Sheet upon creating copy from blank.

Hello,

I am still in the early stages of VBA coding. Doing mostly comparisons thru
forum examples and support from a few people locally.

Big picture overview: I have a weekly report for which I have created a
blank template.

My intent is to create a copy of the blank worksheet and have two things
happen at that time; 1. run macro OpenCalendar() & 2. rename the worksheet
just created to "WE 101505". (WE for week ending and the date will come from
cell value in $O$2).
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jzz Jzz is offline
external usenet poster
 
Posts: 20
Default Run Macro & Rename Sheet upon creating copy from blank.

Hi Kervin,

Why not put a button in you're blank form which calls something like:

Sub weekly()
Dim wbk1 As Workbook
Dim wbk2 As Workbook
Dim savename
Dim mydate As String

Set wbk1 = ActiveWorkbook
Range("A1", ActiveCell.SpecialCells(xlLastCell)).Select 'this takes the
range until
' the last cell used you may want to adapt it to your own range
Selection.Copy
Range("A1").Select
Workbooks.Add (1)
ActiveSheet.Paste
Range("A1").Select
Application.CutCopyMode = False
Set wbk2 = ActiveWorkbook

Call calenderthing 'call your sub here

mydate = Range("O2").Value
savename = Application.GetSaveAsFilename( _
InitialFileName:="WE" + mydate) 'you can leave this one out if you
like
'then put something like : savename = "WE" + mydate + "."
If savename = False Then
wbk2.Saved = True
wbk2.Close
GoTo endsub
Else
savename = savename + "xls"
End If
wbk2.SaveAs Filename:=savename

endsub:
End Sub
Sub calenderthing()

End Sub

Then the copying is also done for you.

Grtz,

Jzz

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
Macro REQ: Automatically copy a template sheet and rename MCSmarties Excel Worksheet Functions 5 October 11th 07 09:18 PM
Button to copy sheet, rename sheet sequencially. foxgguy2005[_3_] Excel Programming 9 June 17th 05 01:41 PM
Copy a sheet and rename it quartz[_2_] Excel Programming 4 March 24th 05 09:36 PM
How to Rename a Blank Sheet that a macro Creates Darin Kramer Excel Programming 3 December 6th 04 12:55 PM
copy Sheet and rename it! John Smith[_9_] Excel Programming 3 September 7th 04 06:23 PM


All times are GMT +1. The time now is 11:00 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"