Re: Prevent UserForm From Moving
Thanks again Dave.
On further investigation, I don't thnk it's a UserForm but an Excel 5 Dialogue Sheet, so there isn't actually a CommandButton_Click() event (If that's what it's called). This is the code I have
Code
Sub DataInput()
Application.ScreenUpdating = False
' Display the Data Input Form
If DialogSheets("InputForm").Show Then
Transfer_Data ' Call the code to transfer data
End If
' Return to the menu
Sheets("Menu").Select
End Sub
Sub Transfer_Data()
'
' Transfer_Data Macro
'
'
' This section transfers the data from the data input form to the Input sheet
Dim Field1 As Date
Field1 = DateValue(DialogSheets("InputForm").EditBoxes(2).Text) ' Req Date
Sheets("Input").Cells(2, 2) = Field1
Field2 = DialogSheets("InputForm").EditBoxes(3).Text 'Req No
Sheets("Input").Cells(2, 3) = Field2
Field3 = DialogSheets("InputForm").EditBoxes(1).Text 'Quantity
Sheets("Input").Cells(2, 5) = Field3
' This section transfers the data from the Input sheet to the Data sheet
Sheets("Data").Visible = True
Sheets("Input").Visible = True
Sheets("Data").Select
Rows("2:2").Select
Selection.Insert Shift:=xlDown ' Insert a row at the top of the database
Range("A3:N3").Select
Selection.Copy 'Copy all the formulae etc up to the first row
Range("A2").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A2").Select
Sheets("Input").Select
Range("A2:E2").Select
Selection.Copy 'Copy the input data to the Data sheet
Sheets("Data").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("Data").Visible = False
Sheets("Input").Visible = False
DataInput 'call the input form again"
End Sub
Display More
Probably not very pretty or efficient, but it does what I need.
Is there some code I can put at the start of this that will determine where on the screen the Dialogue box is displayed?
Cheers
Richard