Userform textbox time format - populated from cell problem displaying 80:00

matija385

Board Regular
Joined
Sep 17, 2014
Messages
77
Hi,

I have problem with time format in userform textbox which is populated from cell.

So, on Sheet3 in column BE i have cells formated as [h]:mm. Value inputed for ie is 80:00 (as in 80 hours). With my code TextBox5 is displaying 8:00:00 (like in my formula bar on worksheet is 3.1.1900 8:00:00).

Can someone please help me my textbox to display 80:00 if in cell is entered 80:00.

My code:
Code:
Private Sub ComboBox9_change()


lokacija = Me.ComboBox4.Value
odsjek = Me.ComboBox6.Value
naziv = Me.ComboBox7.Value
Modul = Me.ComboBox8.Value


Dim i As Integer
Dim LR As Long


LR = Sheet3.Range("AZ" & Rows.Count).End(xlUp).Row


For i = 2 To LR


If Sheet3.Cells(i, "AZ") = lokacija _
And Sheet3.Cells(i, "BA") = odsjek _
And Sheet3.Cells(i, "BB") = naziv _
And Sheet3.Cells(i, "BC") = Modul Then _
Me.TextBox5.Value = Format(Sheet3.Cells(i, "BE"), "hh:mm")


Next i


End Sub

Thnx,

Kind Regards,
Matija
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
See if this works:

Code:
Me.TextBox5.Value = WorksheetFunction.Text(Sheet3.Cells(i, "BE"), "[h]:mm")
 
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top