writing macros

  • Thread starter Thread starter dapco2006
  • Start date Start date
D

dapco2006

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!!!

(e-mail address removed)
 
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!!!

(e-mail address removed)

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/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top