Hi all,
I am trying to find a solution to keep the User form window on top of all other active windows on the PC.
I have tried several solutions but I am a bit of a novice when it comes to coding so I am struggling.
Below is what I have so far:
Sheet 1 Code
Private Sub Worksheet_Change(ByVal Target As Range)
Dim X As Integer
For X = 2 To 1000
If Cells(X, 1).Value <> "" And Cells(X, 2).Value = "" Then
Cells(X, 2).Value = Date & " " & Time
Cells(X, 2).NumberFormat = "d/m/yyyy h:mm:ss AM/PM"
End If
Next
Range("B:B").EntireColumn.AutoFit
Application.EnableEvents = False
If Target.Address = "$A$2" Then
Range("B2").Value = Date & " " & Time()
Range("A3").Select
End If
Application.EnableEvents = True
End Sub
Private Sub CommandButton1_Click()
Application.WindowState = xlMinimized
Unload UserForm1
UserForm1.Show Modeless
End Sub
UserForm1 code
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyReturn Then
Dim emptyRow As Long
emptyRow = WorksheetFunction.CountA(Range("A2:A" & Rows.Count)) + 2
Cells(emptyRow, 1).Value = TextBox1.Value
TextBox1.Value = ""
TextBox1.SetFocus
End If
End Sub
Please help?
I am trying to find a solution to keep the User form window on top of all other active windows on the PC.
I have tried several solutions but I am a bit of a novice when it comes to coding so I am struggling.
Below is what I have so far:
Sheet 1 Code
Private Sub Worksheet_Change(ByVal Target As Range)
Dim X As Integer
For X = 2 To 1000
If Cells(X, 1).Value <> "" And Cells(X, 2).Value = "" Then
Cells(X, 2).Value = Date & " " & Time
Cells(X, 2).NumberFormat = "d/m/yyyy h:mm:ss AM/PM"
End If
Next
Range("B:B").EntireColumn.AutoFit
Application.EnableEvents = False
If Target.Address = "$A$2" Then
Range("B2").Value = Date & " " & Time()
Range("A3").Select
End If
Application.EnableEvents = True
End Sub
Private Sub CommandButton1_Click()
Application.WindowState = xlMinimized
Unload UserForm1
UserForm1.Show Modeless
End Sub
UserForm1 code
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyReturn Then
Dim emptyRow As Long
emptyRow = WorksheetFunction.CountA(Range("A2:A" & Rows.Count)) + 2
Cells(emptyRow, 1).Value = TextBox1.Value
TextBox1.Value = ""
TextBox1.SetFocus
End If
End Sub
Please help?