Thread: Command Buttons
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
aussiegirlone aussiegirlone is offline
external usenet poster
 
Posts: 94
Default Command Buttons

I have a command button's name (sunday) to change automatically when I change
the day on a different worksheet. I have since added six more command buttons
(one for each day of the week), however I do not know how to edit this code
below to include all the other command buttons. Any help would be appreciated
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myCell As Range
Set myCell = Me.Range("A1")

If Target.Cells.Count 1 Then
Exit Sub 'one cell at a time
End If

If Intersect(Target, myCell) Is Nothing Then
Exit Sub
End If

Worksheets("sheet1").CommandButton1.Caption _
= Format(myCell.Value, "mmmm dd, yyyy")

End Sub