#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default Command code

Hello,

I'll try to explain what I want a command to perform, any help would be
greatly appreciated.

I have a file "RCA TRIGGERS.XLSM" I want to add a command button that when I
hit it, it does the following. Copy the current sheet to the end of the
workbook, name the new tab by date and time, clear out the old form, and then
re-save the file. I tried to record a macro to do this and almost had it. The
only problem was that I can't name the tab with the characters that are used
in a date and time.

The second command I want is to hit a button that opens E-mail, attaches the
current sheet as an attachment, and sends the sheet to a specific
distribution list.

Any help will be valued.
--
Thank you for your time!
John
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Command code

Option Explicit
Sub testme()

ActiveSheet.Copy _
after:=Sheets(Sheets.Count)

'the new sheet is now the activesheet
ActiveSheet.Name = Format(Now, "yyyy-mm-dd_hh-mm-ss")

End Sub

There are characters and names you can't use when you name a sheet. I liked
this format of the date/time. But you may want to change to something you like.




Very Basic User wrote:

Hello,

I'll try to explain what I want a command to perform, any help would be
greatly appreciated.

I have a file "RCA TRIGGERS.XLSM" I want to add a command button that when I
hit it, it does the following. Copy the current sheet to the end of the
workbook, name the new tab by date and time, clear out the old form, and then
re-save the file. I tried to record a macro to do this and almost had it. The
only problem was that I can't name the tab with the characters that are used
in a date and time.

The second command I want is to hit a button that opens E-mail, attaches the
current sheet as an attachment, and sends the sheet to a specific
distribution list.

Any help will be valued.
--
Thank you for your time!
John


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default Command code

You guys in here are incredible, I've been trying to figure this out for
hours. Thank you!
--
Thank you for your time!
John


"Dave Peterson" wrote:

Option Explicit
Sub testme()

ActiveSheet.Copy _
after:=Sheets(Sheets.Count)

'the new sheet is now the activesheet
ActiveSheet.Name = Format(Now, "yyyy-mm-dd_hh-mm-ss")

End Sub

There are characters and names you can't use when you name a sheet. I liked
this format of the date/time. But you may want to change to something you like.




Very Basic User wrote:

Hello,

I'll try to explain what I want a command to perform, any help would be
greatly appreciated.

I have a file "RCA TRIGGERS.XLSM" I want to add a command button that when I
hit it, it does the following. Copy the current sheet to the end of the
workbook, name the new tab by date and time, clear out the old form, and then
re-save the file. I tried to record a macro to do this and almost had it. The
only problem was that I can't name the tab with the characters that are used
in a date and time.

The second command I want is to hit a button that opens E-mail, attaches the
current sheet as an attachment, and sends the sheet to a specific
distribution list.

Any help will be valued.
--
Thank you for your time!
John


--

Dave Peterson

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
command code ( GOTO command) in formula calan New Users to Excel 1 June 11th 09 09:44 AM
Code for Command Buttons Ayman Excel Discussion (Misc queries) 1 November 3rd 08 08:37 PM
Code question for clearing a command checkbox. Newbeetle Excel Discussion (Misc queries) 4 February 13th 07 09:05 AM
VBA code behind command button [email protected] Excel Worksheet Functions 1 March 22nd 06 08:13 PM
Command Button VBA code Dave Peterson Excel Discussion (Misc queries) 2 January 25th 05 11:28 PM


All times are GMT +1. The time now is 12:31 PM.

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"