re
et voila la version finale de W7 a 10 et excel 2007 a 2016 que nous avons mis au point Nicolas et moi
avec postion a la cellule et dans!! une plage de cellules
Function PositionForm2(usf, rng)
Dim Zooom#, PtToPx#, cadre#, system
system = Application.OperatingSystem
cadre = Application.Width - Application.UsableWidth
cadre = IIf(system Like "*10*" And Val(Application.Version) <> 12, -cadre / 2.4, cadre / 2.4)
With ActiveWindow
Zooom = .Zoom / 100
PtToPx = ((.ActivePane.PointsToScreenPixelsX(ActiveSheet.[A1].Width) - .ActivePane.PointsToScreenPixelsX(0)) / ActiveSheet.[A1].Width) / Zooom
lleft = (.PointsToScreenPixelsX(rng.Left * PtToPx * Zooom) / PtToPx) + cadre
ttop = .PointsToScreenPixelsY(rng.Top * PtToPx * Zooom) / PtToPx + IIf(system Like "*6*", cadre, 0)
Wwidth = IIf(rng.Columns.Count > 1, rng.Width * (Zooom) - cadre * 2, usf.Width)
Hheight = IIf(rng.Rows.Count > 1, rng.Height * Zooom - cadre, usf.Height)
End With
PositionForm2 = Array(lleft, ttop, Wwidth, Hheight)
End Function
Sub TestUserformtopleftcell2()
r = PositionForm2(UserForm1, [b3])
With UserForm1: .Show 0: .Left = r(0): .Top = r(1): End With
End Sub
Sub TestUserform2()
r = PositionForm2(UserForm1, ActiveCell)
With UserForm1: .Show 0: .Left = r(0): .Top = r(1): End With
End Sub
Sub TestUserformDansPlage2()
r = PositionForm2(UserForm1, [B3:F12])
With UserForm1: .Show 0: .Left = r(0): .Top = r(1): .Width = r(2): .Height = r(3): End With
End Sub