Macro to be enabled when I click on different captions - vba

I need your help to set up below macro in PowerPoint to be enabled when I click on specific caption
For example
I want to add 5 different captions/shapes Monday, Tuesday Wednesday, Thursday,Friday
Currently I add two shapes - and + near TeamBarometer caption and I can control this which is great but I need when I click on Monday to work for Monday , when I click on Tuesday to work only for Tuesday etc
I don't have much experience and I really need your support
Sub TeamBarometer_minus ()
TeamBarometer.Caption = (TeamBarometer.Caption) -1
End Sub
Sub TeamBarometer_plus ()
TeamBarometer.Caption = (TeamBarometer.Caption) +1
End Sub
Thank you in advance

Related

Access VBA for command button

when I debug in the editor I don't get syntax errors, but when I click the button on my form nothing happens. Trying to add 6 months to the field with a click of the button. Does anyone know if this code is wrong or incomplete?
Private Sub Ctl6mosBtn_Click()
EXPIRATIONDATE = [AUTO POLICIES.EFFECTIVE DATE] = DateAdd("m", 6, EXPIRATIONDATE)
End Sub
Thanks for you any insight
Frank
I have two fields on my form
1-AUTO POLICIES.EFFECTIVE DATE which is the effective date of a policy.
2-EXPIRATIONDATE which is the expiration date of the policy.
I have a button labeled 6 Mos which when clicked should fill the EXPIRATIONDATE 6 months after the Effective Date. Nothing happens, no errors, fields doesn't fill!

Display row number without moving column

I have built a 12 month roster in which I have the 365 days across 365 columns and my 120 employees listed down in each row, down to row 120.
I am looking for some VBA code that will allow me to (for example) to display row 120 whilst keeping the active column in display.
I am currently using the below simple code which does highlight the row but resets the column set to show Column A. I am using toggle buttons to initiate the macros.
Sub ToggleButton3_Click()
Cells(ActiveCell.Row, "70").Activate
End Sub
Any tips, solutions or advice would be greatly appreciated!
Thank you!
You should create a procedure like this:
Public Sub MoveToRow()
ActiveSheet.Cells(70, ActiveCell.Column).Activate
End Sub
And associate it to a keyboard shortcut (i.e. CTRL + J). Open the Macro Dialog -> Select ThisWorkBook.MoveToRow() -> Click the "Options" Button -> Assign the shortcut. It works :)

Going through day, month and year on VBA DTPicker using TAB

On my userform with a calendar users can quickly navigate through all inputfields with the TAB order. That also works for the DTPicker insofar that the focus is set on the DTPicker first element = Day (I have format dd/MM/yyyy). However, after entering the day and pressing TAB the focus is on the next TextBox instead of the Month of the DTPicker.
Is there a way to use keyboard to set focus on MM after entering dd and on yyyy after entering MM? Or that after entering the day the cursos automatically moves to month and then to year?
Thanks a lot!

Powerpoint slides: how to copy my combobox and textbox controls on one slide to a another slide, same presentation?

Powerpoint Slides: Trying to create duplicate slides so that user can, on each slide,
1. select an option
2. enter free text.
I have the following VBA and controls in Slide2, I want to copy everything, including combobox and textbox, from slide2 for any/all subsequent slides. I want an easy way to do this. just copying or duplicating the slides will not allow users to make selections or add free text on any slides after slide2 (the original). Although the controls still APPEAR on the subsequent slides, no selection or typing can be made. Subsequent slides contain the VBA script but not any controls copied over? I'm new-ish to this so not sure all of my language is correct here.(i used to know how to do all this stuff about 12 years ago, lol)
Please tell me there is a fast and easy way to do this! It's taken me all afternoon to teach myself the current script (combo/text boxes) and research a slide copy fix, to no avail.
Here's my simple script for the combo box and textbox from slide2.
Private Sub ComboBox1_DropButtonClick()
If ComboBox1.ListCount = 0 Then
With ComboBox1
.AddItem "Select One", 0
.AddItem "Accept", 1
.AddItem "Reject", 2
ComboBox1.ListRows = 3
End With
End If
End Sub
Private Sub TextBox1_Change()
End Sub
Not sure if I understand everything you want, but this duplicates slide 1, including all the code belonging to the controls in the slide:
ActivePresentation.Slides(1).Duplicate
Let me know if there's something I'm missing

How to replace label with dates

I am using Visual Basic 2010. My question can best explained by these images.
I would like to know how to make the labels appear as dates depending on what the DateTimePicker is set on. For Example:
This is what the code looks now that I have solved my issue.
Private Sub MonthCalendar1_DateChanged(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DateRangeEventArgs) Handles MonthCalendar1.DateChanged
Me.Label14.Text = CStr(Me.MonthCalendar1.SelectionRange.Start)
Me.Label13.Text = CStr(Me.MonthCalendar1.SelectionRange.Start.AddDays(6))
Me.Label12.Text = CStr(Me.MonthCalendar1.SelectionRange.Start.AddDays(1))
Me.Label11.Text = CStr(Me.MonthCalendar1.SelectionRange.Start.AddDays(2))
Me.Label10.Text = CStr(Me.MonthCalendar1.SelectionRange.Start.AddDays(3))
Me.Label9.Text = CStr(Me.MonthCalendar1.SelectionRange.Start.AddDays(4))
Me.Label15.Text = CStr(Me.MonthCalendar1.SelectionRange.Start.AddDays(5))
End Sub
I don't have Visual Studio installed on this computer, so I can't give you the exact code, so I will try to explain it.
In the code of the event for the DateTimePicker, you have to calculate for each label the difference in days of the week from your date to the date you want to show (Wednesday to Saturday - 3 days (and you have a little error in the images - you have to switch Wednesday with Tuesday), Thursday to Saturday - 2 days, and so on...).
After that, you subtract (or add, if the day is after the chosen date) the referential date with the corresponding value from above, and you get the date needed. Now you only have to show the result in the label.
Found the answer to my own question.
To retrieve a date and display it in a label:
In the File menu, click New Project.
The New Project dialog box appears.
Click Windows Forms Application and then click OK.
Add a Label control to the form, leaving the default name Label1.
Remove the text from the Text property of the Label control.
Add a MonthCalendar control to the form, leaving the default name MonthCalendar1.
Double-click the MonthCalendar control to enter the default event handler in the Code Editor.
In the MonthCalendar1_DateChanged event handler, add the following code to add items to the list:
Me.Label1.Text = CStr(Me.MonthCalendar1.SelectionRange.Start)
Return to Designer view and add a DateTimePicker control to the form, leaving the default name DateTimePicker1.
Double-click the DateTimePicker control to enter the default event handler in the Code Editor.
In the DateTimePicker_ValueChanged event handler, add the following code to add items to the list:
Me.Label1.Text = CStr(Me.DateTimePicker1.Value)
Press F5 to run the program.
When the form appears, click a date in the MonthCalendar control and verify that the date is displayed in the label.
Click the drop-down arrow of the DateTimePicker control and select a date.
The date and time are displayed in the label.