Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / May 2008

Tip: Looking for answers? Try searching our database.

writing macros

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dapco2006 - 28 May 2008 19:57 GMT
i dont really know anything about macros but i need to insert a command
button into a calendar that, once pushed will insert "vacation" and
background color into the cell that is high-lighted.  

can anyone please help me!!!

dapco2006@yahoo.com
T Lavedas - 28 May 2008 20:30 GMT
On May 28, 2:57 pm, dapco2006 <dapco2...@discussions.microsoft.com>
wrote:
> i dont really know anything about macros but i need to insert a command
> button into a calendar that, once pushed will insert "vacation" and
[quoted text clipped - 3 lines]
>
> dapco2...@yahoo.com

I used the Tools/Macros/Record macro to do the actions you described
and got pretty much the whole thing ...

Public Sub Macro1()
'
' Macro1 Macro
' Macro recorded 5/28/2008 by Tom Lavedas
'

'
   ActiveCell.FormulaR1C1 = "Vacation"
   With ActiveCell.Interior
       .ColorIndex = 6 ' yellow
       .Pattern = xlSolid
   End With
End Sub

Then I activated the Control Toolbox (View/Toolbars), selected design
mode and pasted in the button, right clicked on the button and
selected View code and added the word Macro1 to the supplied code
framework for CommandButton1 and modified the macro subroutine by
making it Public ...

Private Sub CommandButton1_Click()
 Macro1
End Sub

Turned off design mode and tested it on cell A1.  Worked the first
time.  Elapsed time 3 minutes.  The Record macro tool is your
friend ;-)

The macro code could also be moved to the CommandButton routine
instead and the macro routine deleted.

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.