Hi Guys, I in need of some expertise help, I have been working on and it is as well part of my learning curve. I have modified one of my old Userform database to create another one which has 5 textboxes, what I’ve been trying to do
That if textbox1 is > 1 and textbox5 =””. I would like to ‘Worksheet Cell, Backcolor =RGB(100 , 100, 100), which in my database ‘SampleTestFile’ happens to be is Column 6.
I have never attempted this before so my knowledge is very limited. With many thanks, I quite appreciated if I can get some help with some explanation
Thanks
That if textbox1 is > 1 and textbox5 =””. I would like to ‘Worksheet Cell, Backcolor =RGB(100 , 100, 100), which in my database ‘SampleTestFile’ happens to be is Column 6.
I have never attempted this before so my knowledge is very limited. With many thanks, I quite appreciated if I can get some help with some explanation
Thanks
VBA Code:
Private Sub cmdAdd_Click()
'dimention the variable
Dim DataSH As Worksheet
Dim Addme As Range
'set the variable
Set DataSH = Sheet1
'error handler
On Error GoTo errHandler:
'set variable for the destination
Set Addme = DataSH.Cells(Rows.Count, 3).End(xlUp).Offset(1, 0)
'hold in memory and stop screen flicker
Application.ScreenUpdating = False
If Me.textbox1 = "" Then
MsgBox "Insufficient Data"
Exit Sub
End If
'send the values to the database
With DataSH
'Textbox5 Format
If Me.textbox2 > 1 & Me.textbox4 = "" Then
DataSH.Cells(Rows.Count, 6).Me.textbox4.BackColor = RGB(100, 100, 100)
End If
'add the unique reference ID then all other values
'Column B = Seq IS Auto Generated
Addme.Offset(0, -1) = DataSH.Range("C6").Value + 1
'Column.C = Time.A
Addme.Value = Me.textbox1
'Column.D = Time.B
Addme.Offset(0, 1).Value = Me.textbox2
'Column.E = Time.B-A
Addme.Offset(0, 2).Value = Me.textbox3
'Column.F = Time.in Minutes
Addme.Offset(0, 3).Value = Me.textbox4
End With
Last edited by a moderator: