Questo da inserire nel modulo di codice della UserForm:
#If Win64 Then
Private Declare PtrSafe Function GetDC& Lib "user32.dll" (ByVal hwnd&)
Private Declare PtrSafe Function GetDeviceCaps& Lib "gdi32" (ByVal hDC&, ByVal nIndex&)
#Else
Private Declare Function GetDC& Lib "user32.dll" (ByVal hwnd&)
Private Declare Function GetDeviceCaps& Lib "gdi32" (ByVal hDC&, ByVal nIndex&)
#End If
Dim wk As Worksheet
Private Sub UserForm_Initialize()
Set wk = ThisWorkbook.Worksheets("Foglio1")
Call FormAlign(Me, wk.Cells(3, 9))
End Sub
Sub FormAlign(MyForm, MyCell As Range)
Dim x#, y#
x = GetDeviceCaps(GetDC(0), 88) / 72
y = GetDeviceCaps(GetDC(0), 90) / 72
With MyForm
.StartUpPosition = 0
.Left = ActiveWindow.PointsToScreenPixelsX(MyCell.Left * x) * 1 / x
.Top = ActiveWindow.PointsToScreenPixelsY(MyCell.Top * y) * 1 / y
'.Show
End With
Set MyForm = Nothing
End Sub
In grassetto la parte da modificare secondo le tue esigenze.