ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   VB help required (https://www.excelbanter.com/excel-discussion-misc-queries/235748-vbulletin-help-required.html)

adeel via OfficeKB.com

VB help required
 
I have a work book with 30 sheets (dates), first sheet is manu sheet, i
insert a calender object & a button. i just want that i click any date on
calender then click button and the sheet of selected date should be open.....
may be some vb use....please help

--
Message posted via http://www.officekb.com


Shane Devenshire[_2_]

VB help required
 
Hi,

Cute idea, never thought of that. OK, here goes:

1. Choose View, Toolbars, Control Toolbox
2. On the control toolbox click the More Controls button - the last button
3. Scroll the list and find the Calendar10 control (the number will depend
on the version of that happens to be installed on your computer), click the
control and then click in the spreadsheet.
4. Right-click the calendar and choose View Code
5. Modify the subroutine to read

Private Sub Calendar1_Click()
Dim myDay As String
myDay = Me.Calendar1.Day
Sheets(myDay).Select
End Sub

Now return to the spreadsheet and turn off Design Mode on the Control
Toolbox toolbar - the 1st tool

Now to make this work the sheets must be named 1, 2, 3, ...31 just numbers.
If you are using a different naming convention you will need to modify the
code.
--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"adeel via OfficeKB.com" wrote:

I have a work book with 30 sheets (dates), first sheet is manu sheet, i
insert a calender object & a button. i just want that i click any date on
calender then click button and the sheet of selected date should be open.....
may be some vb use....please help

--
Message posted via http://www.officekb.com



adeel via OfficeKB.com

VB help required
 
Thanks alot, it works....but in my work book there are month wise sheet eg.
(from 1st jun to 30th jun & from 1st july to 31st july) in first sheet i want
to add this calender and then i want if the month in this calender is June
and then i press 1 or 2 or 3.... it move to that sheet of june, similarly
when i change the month to July then press 1 or 2 or 3....it move to that
sheet of july.....

Shane Devenshire wrote:
Hi,

Cute idea, never thought of that. OK, here goes:

1. Choose View, Toolbars, Control Toolbox
2. On the control toolbox click the More Controls button - the last button
3. Scroll the list and find the Calendar10 control (the number will depend
on the version of that happens to be installed on your computer), click the
control and then click in the spreadsheet.
4. Right-click the calendar and choose View Code
5. Modify the subroutine to read

Private Sub Calendar1_Click()
Dim myDay As String
myDay = Me.Calendar1.Day
Sheets(myDay).Select
End Sub

Now return to the spreadsheet and turn off Design Mode on the Control
Toolbox toolbar - the 1st tool

Now to make this work the sheets must be named 1, 2, 3, ...31 just numbers.
If you are using a different naming convention you will need to modify the
code.
I have a work book with 30 sheets (dates), first sheet is manu sheet, i
insert a calender object & a button. i just want that i click any date on
calender then click button and the sheet of selected date should be open.....
may be some vb use....please help


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200907/1



All times are GMT +1. The time now is 11:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com