I tried MD but it tells me I've already posted the book in this thread. The earlier version doesn't have my latest work. Will try again.
I tried MD but it tells me I've already posted the book in this thread. The earlier version doesn't have my latest work. Will try again.
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Your textboxes are all individually named, so you can add across pages as you do within a page. Also, you nevere refer to EmploeeInduction within the form code, use Me.
Hi Ted,
I suggest you use linebreaks in your code as Bob showed earlier. It makes it much easier to follow what you're totalling
eg
[VBA]Private Sub txtgenpoints_Enter()
txtgenpoints.Text = CDbl(txtethics.Value) _
+ CDbl(txtreliability.Value) _
+ CDbl(txtcommunication.Value) _
+ CDbl(txtteamwork.Value) _
+ CDbl(txtohs.Value)
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Consider it done Sire
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Adding down each page of the multipage is working but trying to get the subtotals to add is becoming very confusing.
[vba]Private Sub txtReviewPoints_Click()
txtReviewPoints.Text = CDbl(txtGenPoints.Value)
+ CDbl(txtPrPoints.Value)
+ CDbl(txtHorPoints.Value)
+ CDbl(txtHosPoints.Value)
+ CDbl(txtIndPoints.Value)
+ CDbl(txtKillPoints.Value)
+ CDbl(txtAutPoints.Value)
End Sub
[/vba]
Follows the same principle being used to count the individual points on a single page within the multipage control. I've changed from a Click event to Change event but no totalling is occuring in the textbox txtReviewPoints on the Employee Details page of the multipage.
What have I done wrong?
The second part of the question for tonight is I wanted to apply a "A", "B","C","D","E" type grade to the total points for each subgroup and have it shown on the Employee Details page of the Multipage control. I tried to use the following but have a feeling that I should perhaps have used a Case Select code. For Example
[vba]Private Sub txtGeneralRating_Enter()
If txtGenPoints.Value > 32 Then
txtGeneralRating.Text = "A"
Else
If txtGenPoints.Value > 24 Then
txtGeneralRating.Text = "B"
Else
If txtGenPoints.Value >16 Then
txtGeneralRating = "C"
Else
If txtGenPoints.Value >8 Then
txtGeneralRating.Text = "D"
Else
If txtGenPoints.Value =< 8 Then
txtGeneralRating.Text = "E"
End If
End If
End If
End If
End IF
End Sub[/vba]
This sub Group General has a maximum points value of 40, where as all the other sub groups will have a maximum value of 50 points per group, with the breakdowns being 40, 30, 20, 10 and less than 10.
Could someone show me how I should have done this bit please?
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Part 2 first
[VBA]Private Sub txtGeneralRating_Enter()
Select Case txtGenPoints.Value
Case Is > 32
txtGeneralRating.Text = "A"
Case Is > 24
txtGeneralRating.Text = "B"
Case Is > 16
txtGeneralRating.Text = "C"
Case Is > 8
txtGeneralRating.Text = "D"
Case Else
txtGeneralRating.Text = "E"
End Select
End Sub
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Ok. Thank you Malcolm. I'll adjust the code where necessary to fix this point.
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Hi Ted,
Ignore my last post (but it does demonstrate the principles)
Firstly, you're missing the line breaks " _" in your code.
Second; Create two functions, one for each rating, Use the Change Event of the Total box to pass the total to the function, which should return A-E. Write this value to the Details page.
If you need help, let me know.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
[VBA]Private Sub txtGenPoints_Change()
txtGeneralRating.Text = RateGen(txtGenPoints.Value)
End Sub
Function RateGen(Score As Double) As String
Select Case Score
Case Is > 32
RateGen = "A"
Case Is > 24
RateGen = "B"
Case Is > 16
RateGen = "C"
Case Is > 8
RateGen = "D"
Case Else
RateGen = "E"
End Select
End Function
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
MD, I've just come from adjusting the code to your first example....
Okay I'll go back and have another crack at it. and thanks once again for your help.
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
IN writing the two functions can i refer to one as RateGen1 and the other RateGen2?Originally Posted by mdmackillop
Any other changes I need to make in doubling up the code?
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Sorry about that , but I think you'll find this way easierOriginally Posted by Aussiebear
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
I'd probably go for RateOther as only one is General. That, and change the scores of course!
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Righto..... I'll do that then I'm off to bed. It is after all 1:07am and I need lots of beauty sleep at my age.
and.. I didn't follow the second part of your suggestion in post 48. Could you leave me something to look at when I come back on line in the morning please?
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Goodnight.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Malcolm has kindly tidied up my rather pathetic effort at coding. thank you for that.
I had origonally allowed for the form to load on opening of the workbook, but MD has placed a button on the page which does the same thing. If I use MD's button to load the form the combobox to select the name of the employee, and it works fine. If I come from the VBE environment and use the run button the combobox picks up the wrong data.
I've tried looking at the code but can't find out why it does this. Can someone give me some advice on how this can be overcome?
Secondly, I was looking at activating the calendar control so that when you click on the Review date textbox, up pops the calendar and allows the user to select the date, then once selected the value is written to the textbox.
I've searched for code examples and have foound the following
[vba]Private sub Calendar1_Click()
ActiveCell.Value = Calendar1.Value
Unload Me
End Sub[/vba]
Further down in the article it suggested that I needed to initialize the form with the following code
[vba]Private Sub Userform_Initialize()
IfIsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date
End If
End Sub
[/vba]
Where it talks about ActiveCell.Value, can I replace "ActiveCell.Value" with the name of the textbox as in "txtReviewDate.Value", so that it ties the calendar to the textbox?
I've left the calendar showing on the form so as to indicate where I hoped it would pop up when triggerred.
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Ted,
I couldn't reproduce the button, VBE problem, both showed the same.
On the calendat, of course you can
[vba]
Private Sub Calendar1_Click()
Me.txtReviewDate.Text = Calendar1.Value
End Sub
Private Sub txtReviewDate_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If IsDate(txtReviewDate.Text) Then
Calendar1.Value = DateValue(txtReviewDate.Text)
Else
Calendar1.Value = Date
End If
End Sub
[/vba]
Bob, Does the Calendar then close after a date is selected?
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
No, you have to make it visible/non-visible AFAIR.
Today's Date shows as 4/1/07 rather than 1/4/07. In the properties window the format is shown as 1/4/07. Do I have to reformat the date layout in the code within the sub to get this right?
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link