LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
Sloth
 
Posts: n/a
Default Questions concerning VBA coding

I recently created a new macro that copies a sheet named Template and changes
the name according to the result of cell K2, and then deletes cell K2 in the
new sheet. K2 contains the formula...

=TEXT(TODAY(),"mm-dd-yyyy")&" ;
"&TEXT(YEAR(TODAY()),"yy")&TEXT(TODAY()-DATE(YEAR(TODAY()),1,0),"###")

it outputs something like "12-19-2005 ; 05353"

and the code is

Sub Copy_Template()
Sheets("Template").Copy Befo=Sheets("Template")
Sheets("Template (2)").Name = Cells(2, 11)
Range("K2").Select
Selection.ClearContents
End Sub

I am extremely new to VBA coding and created this code by editing a recorded
macro. I have three questions concerning this macro.
1. How can I include the K2 formula in the coding?
2. I created a custom button and added it to the toolbar. If the file is
not open, I want the button to do nothing, or bringup an error message
(something like "This button is unavailible). Is this possible, or something
equally effective?
3. For you programers out there, is there anything majorly wrong with this
macro? In works for now, but I don't want to accidently overwrite, or
delete, anything in the future.

Also, can anyone suggest a good book to learn VBA programming?
 
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
Finding my previous questions... cdavidson Excel Discussion (Misc queries) 2 November 17th 05 06:12 PM
Pivot Table for survey data w/ questions as Rows & poss answrs as pfwebadmin Excel Discussion (Misc queries) 0 May 17th 05 02:31 PM
Puzzling Format Questions Kevin H. Stecyk Excel Discussion (Misc queries) 3 May 17th 05 11:44 AM
Hidding Macro names and coding mrbalaje Excel Discussion (Misc queries) 4 April 20th 05 04:23 PM
2 Questions Beth Excel Worksheet Functions 3 December 1st 04 06:01 PM


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