• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Problems positioning UserForm

Hello again,

I had this working before but, for some reason I messed it up. I have a UserForm called "New_Line_Insert" and I'm trying to get it near the top right hand side of the screen.

I have the following code in my 'ThisWorkbook'
Code:
Private Sub UserForm_Activate()
    With New_Line_Insert
        .Top = Application.Top + 1025 '< change 125 to what u want
        .Left = Application.Left + 2025 '< change 25 to what u want
    End With
End Sub
No good, I've tried:

Code:
Private Sub UserForm_Activate()
    With UserForm
        .Top = Application.Top + 1025 '< change 125 to what u want
        .Left = Application.Left + 2025 '< change 25 to what u want
    End With
End Sub

I've also put these Codes on mySheet4 Object where it is supposed to be working!!

The Userform is appearing but it is in the middle to the Left of the screen??
 
Hello again,

I had this working before but, for some reason I messed it up. I have a UserForm called "New_Line_Insert" and I'm trying to get it near the top right hand side of the screen.

I have the following code in my 'ThisWorkbook'
Code:
Private Sub UserForm_Activate()
    With New_Line_Insert
        .Top = Application.Top + 1025 '< change 125 to what u want
        .Left = Application.Left + 2025 '< change 25 to what u want
    End With
End Sub
No good, I've tried:

Code:
Private Sub UserForm_Activate()
    With UserForm
        .Top = Application.Top + 1025 '< change 125 to what u want
        .Left = Application.Left + 2025 '< change 25 to what u want
    End With
End Sub

I've also put these Codes on mySheet4 Object where it is supposed to be working!!

The Userform is appearing but it is in the middle to the Left of the screen??
The code should be in the userform module, not ThisWorkbook, and you should use:

Code:
With Me

rather than:

Code:
With Userform
 
Hi, FranktheBank!
Glad you solved it. Thanks for your feedback and welcome back whenever needed or wanted.
Regards!
 
I'm back!! I thought it was solved but all that happened was the Box moved to the top and it didn't and won't go to the right!! Here's what I have in it's completeness:

In ThisWorkbook
Code:
Private Sub Workbook_Open()
    New_Line_Insert.Show
End Sub

This allows users to Open UserForm.

In Userform
Code:
Private Sub New_Line_Insert_Click()
    NextRow = ActiveCell.Row + 1
    Dim r As Range
    Const myPass As String = "Assumption" 'Allows Protected Sheet to be unlocked to insert Rows
    Set r = ActiveCell
       Application.ScreenUpdating = False
       With ActiveSheet
        .Unprotect myPass
        r.EntireRow.Copy
        r.Offset(1).EntireRow.Insert shift:=xlDown
        'Clear constants
            If Range("C" & NextRow) = 0 Then
            Else
        r.Offset(1).EntireRow.SpecialCells(xlCellTypeConstants).ClearContents
            End If
        .Protect myPass
    End With
       Application.CutCopyMode = False
    Application.ScreenUpdating = True
    Cells(NextRow, 3).Select
End Sub

This unlock Worksheet and Insert Row and Clear Contents

In Module1
Code:
Sub New_Line_Activate()
    New_Line_Insert.Show
End Sub
    Private Sub New_Line_Insert_Activate()
    With UserForm
        .Top = Application.Top + 125 '< change 125 to what u want
        .Left = Application.Left + 425 '< change 25 to what u want
    End With
End Sub

The first part is duplication to 'Start' the UserForm but the Second is supposed to position the Userform.

My Userform is Named: New_Line_Insert, sorry I can't link pictures
 
Back
Top