Hi to all and I'm glad to be here.
I use Excel but I am no expert and much I do is trial and eroor at times.
I trying to make a program to keep track o production. I have a main page where I have my command buttons that open forms to edit data.
The form opens and I recall a listbox for the item in production Status, I select the item and its put into the cells on the form after change the cells
I write this data back to the listbox and page. Well thats whats it supposed to do. Problem is if I run it from the main page it will not update the records
but if I run it from the sheet where the records are it work.
Here is the code
Also I can't get the textboxs to format as hh:mm the ones in the listbox work but if I try to use for example
its does not work.
Thanks for any help.
I use Excel but I am no expert and much I do is trial and eroor at times.
I trying to make a program to keep track o production. I have a main page where I have my command buttons that open forms to edit data.
The form opens and I recall a listbox for the item in production Status, I select the item and its put into the cells on the form after change the cells
I write this data back to the listbox and page. Well thats whats it supposed to do. Problem is if I run it from the main page it will not update the records
but if I run it from the sheet where the records are it work.
Here is the code
Code:
Private Sub CommandButton1_Click()
Dim i As Long
For i = 1 To Application.WorksheetFunction.CountA(Range("A:A"))
For x = 1 To 9
If Sheet6.Cells(i, "A").Value = Me.TextBox1.Text Then
Sheet6.Cells(i, x).Value = Me("TextBox" & x).Value
End If
Next x
Next i
End Sub
Private Sub ShowProduzione_Click()
Produzione.ColumnCount = 9
Produzione.RowSource = "Movimenti!A:I"
End Sub
Private Sub Produzione_AfterUpdate()
Me.TextBox1.Value = Me.Produzione.Column(0)
Me.TextBox2.Value = CDate(Me.Produzione.Column(1))
Me.TextBox3.Value = Format(Me.Produzione.Column(2), "hh:mm")
Me.TextBox4.Value = CDate(Me.Produzione.Column(3))
Me.TextBox5.Value = Format(Me.Produzione.Column(4), "hh:mm")
Me.TextBox6.Value = Format(Me.Produzione.Column(5), "hh:mm")
Me.TextBox7.Value = Me.Produzione.Column(6)
Me.TextBox8.Value = Me.Produzione.Column(7)
Me.TextBox9.Value = Me.Produzione.Column(8)
Dim i As Long
For i = 1 To Application.WorksheetFunction.CountA(Range("A:A"))
For x = 1 To 9
If Sheet6.Cells(i, "A").Value = Me.TextBox1.Text Then
Me("TextBox" & x).Value = Sheet6.Cells(i, x).Value
End If
Next x
Next i
End Sub
Also I can't get the textboxs to format as hh:mm the ones in the listbox work but if I try to use for example
Code:
Me.TextBox6.Value = Format(Me.Textbox6.Value, "hh:mm")
Thanks for any help.
Last edited by a moderator: