Hiding Buttons

K

K1KKKA

Hi all,

HYCH with this

I have 7 buttons on a page but would like 1 to be displayed depending
on a given criteria, ie day of the week.
I was hoping the simple code below would work, but appears not.
Any helps please??


Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
With ActiveWindow
Application.Command("button 6").Visible = False
End With
If Weekday(Worksheets("sheet1").Range("g1").Value) = vbWednesday
Then
TextBox1_Click.Show
Else
somefrm.Show
End If
End Sub


Steve
 
K

K1KKKA

Hi all,

HYCH with this

I have 7 buttons on a page but would like 1 to be displayed depending
on a given criteria, ie day of the week.
I was hoping the simple code below would work, but appears not.
Any helps please??

Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
With ActiveWindow
Application.Command("button 6").Visible = False
End With
If Weekday(Worksheets("sheet1").Range("g1").Value) = vbWednesday
Then
TextBox1_Click.Show
Else
somefrm.Show
End If
End Sub

Steve


For information purposes,

This works fine :)



Private Sub Workbook_Open()
Worksheets("Sheet1").Activate
ActiveSheet.Shapes("Btn1").Visible = False
ActiveSheet.Shapes("Btn2").Visible = False
ActiveSheet.Shapes("Btn3").Visible = False
If Weekday(Worksheets("sheet1").Range("g1").Value) = vbWednesday
Then
ActiveSheet.Shapes("Btn").Visible = True
Else
If Weekday(Worksheets("sheet1").Range("g1").Value) = vbThursday
Then
ActiveSheet.Shapes("Btn2").Visible = True
Else
If Weekday(Worksheets("sheet1").Range("g1").Value) = vbFriday Then
ActiveSheet.Shapes("Btn3").Visible = True
End If
End If
End If
End Sub
 

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

Similar Threads

Xlveryhidden 9
Time issue with Day Format 1
Code to format cells on several worksheets 2
workbooks keep hiding 1
Command Buttons 3
Weekday question 9
Textbox to show date 2
Open workbook 2

Top