• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Formula Excel Result in Textbox

JUES

New Member
Good afternoon friends, I hope you are well.

I need to make some changes functional that I introduced in the Form Conf (frmconf) so that depending on the value assumed by the txtOpt.Value, the values that are shown in the txtTDFM.Value and the txtTDL.Value are equal to the result of the following formulas:

If txtOpt.Value = 1, 2 and 4

Code:
txtTDFM.Value = DAY(EOMONTH(TODAY(),-1))-(WORKDAYS.INTL(EOMONTH(TODAY(),-2)+1,EOMONTH(TODAY(),-1),""0000011"",('USUARIOS & PRIVILEGIOS'!$N$5:$N$34)))"

Code:
txtTDL.Value = NETWORKDAYS.INTL(EOMONTH(TODAY(),-2)+1,EOMONTH(TODAY(),-1),""0000011"",('USUARIOS & PRIVILEGIOS'!$N$5:$N$34))"

If txtOpt.Value = 3

Code:
txtTDFM.Value = DAY(EOMONTH(TODAY(),-1))-(NETWORKDAYS.INTL(EOMONTH(TODAY(),-2)+1,EOMONTH(TODAY(),-1),""0000011"",('USUARIOS & PRIVILEGIOS'!$N$5:$N$18)))"

Code:
txtTDL.Value = NETWORKDAYS.INTL(EOMONTH(TODAY(),-2)+1,EOMONTH(TODAY(),-1),""0000011"",('USUARIOS & PRIVILEGIOS'!$N$5:$N$18))"

The expected values for the month of September (due to technical requirement, the previous month is calculated) are: txtTDFM.Value = 9, txtTDL.Value = 21
 

Attachments

  • FORMULAS EN TEXTBOX PRUEBA.xlsm
    141.6 KB · Views: 2
Greetings @Marc L could you help me with a solution?

PD: I had a writing error, the formulas must be placed in the HHE Form (frmhhe)
 
Last edited:
Hello, use a Select Case block according to txtOpt value in order to set txtTDFM and txtTDL values​
or just an If block based on txtOpt value equals to 3 combined with an additional Else part …​
 
Hello, use a Select Case block according to txtOpt value in order to set txtTDFM and txtTDL values​
or just an If block based on txtOpt value equals to 3 combined with an additional Else part …​
Greetings @Marc L

I tried this way but it doesn't make the formulas functional but reflects them as text in both textboxes

Code:
Private Sub txtOpt_Change()
    'Validación de la Formula
    Select Case txtOpt
        Case 1, 2, 4
            txtTDL.Value = "=NETWORKDAYS.INTL(EOMONTH(TODAY(),-2)+1,EOMONTH(TODAY(),-1),""0000011"",('USUARIOS & PRIVILEGIOS'!$N$5:$N$34))"
            txtTDFM.Value = "=DAY(EOMONTH(TODAY(),-1))-(NETWORKDAYS.INTL(EOMONTH(TODAY(),-2)+1,EOMONTH(TODAY(),-1),""0000011"",('USUARIOS & PRIVILEGIOS'!$N$5:$N$34)))"
        Case 3
            txtTDL.Value = "=NETWORKDAYS.INTL(EOMONTH(TODAY(),-2)+1,EOMONTH(TODAY(),-1),""0000011"",('USUARIOS & PRIVILEGIOS'!$N$5:$N$18))"
            txtTDFM.Value = "=DAY(EOMONTH(TODAY(),-1))-(NETWORKDAYS.INTL(EOMONTH(TODAY(),-2)+1,EOMONTH(TODAY(),-1),""0000011"",('USUARIOS & PRIVILEGIOS'!$N$5:$N$18)))"
        End Select

End Sub
 
Back
Top