Thread: Command Button
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Simon Lloyd[_539_] Simon Lloyd[_539_] is offline
external usenet poster
 
Posts: 1
Default Command Button

Hi you need to go to tools VBA edito and right click in the area on your
left where you have "this workbook" and choose insert module (you dont
have to give it a name) and paste the code i have given you there. Now
go back to your excel workbook by clicking the green X at the top left
of your page. Now right click on the tool bar at the top of your excel
page, choose customise, and then commands, scroll down to macros and
drag a custom button on to your tool bar, repeat for your second, now
right click each button in turn and select assign macro at the bottom
and assign buuton1 to the first button etc. You cat work out how to
change the names and pictures of your buttons from the menu you have on
screen.

Hope this helps!

Simon

here's the code!

Option Explicit
Sub button1()
ActiveCell.Select
With Selection.Interior
ColorIndex = 3 'red
Pattern = xlSolid
PatternColorIndex = xlAutomatic
End With
End Sub
Sub button2()
ActiveCell.Select
With Selection.Interior
ColorIndex = 6 'yellow
Pattern = xlSolid
PatternColorIndex = xlAutomatic
End With
End Sub


---
Message posted from http://www.ExcelForum.com/