1er à 4 et l'autre à 5 et colonne A réduite à 20
Pièce jointe 280809
Pièce jointe 280811
Version imprimable
1er à 4 et l'autre à 5 et colonne A réduite à 20
Pièce jointe 280809
Pièce jointe 280811
d'accord donc -4 c'est bon j'ai toi et +4 c'est c'est bon chez moi a vu d'œil bien évidement
donc si chez toi
donne 12Code:cadre=Application.Width - Application.UsableWidth
et chez moi ca donne '9.59999999999991
et que chez toi entre -5 et -4 tu vois pas la différence
on peut faire alors
on a ainsi une mesure génériqueCode:
1
2 cadre = Application.Width - Application.UsableWidth cadre = IIf(Application.OperatingSystem Like "*10*" And Val(Application.Version) <> 12, -cadre / 3, cadre / 2)
edit c'est bon j'ai un calcule qui me donne -5 pour toi et 4 pour moi
c'est cadre/2.4
Avec ce code parce que j'ai d'autre test mais c'est le bordel
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 Function PositionForm(usf, rng) Dim Z As Double, K As Double, E As Double Z = ActiveWindow.Zoom / 100 K = ((ActiveWindow.ActivePane.PointsToScreenPixelsX(ActiveSheet.[A1].Width) - ActiveWindow.ActivePane.PointsToScreenPixelsX(0)) / ActiveSheet.[A1].Width) / Z E = IIf(Application.OperatingSystem Like "*10*" And Val(Application.Version) <> 12, -5, 1) lleft = (ActiveWindow.PointsToScreenPixelsX(rng.Left * K * Z) / K) + E ttop = ActiveWindow.PointsToScreenPixelsY(rng.Top * K * Z) / K Wwidth = IIf(rng.Columns.Count > 1, (rng.Width * Z) + 10, usf.Width) Hheight = IIf(rng.Rows.Count > 1, (rng.Height * Z) + 5, usf.Height) PositionForm = Array(lleft, ttop, Wwidth, Hheight) UserForm1.Label1.Caption = "Zoom" & " " & Z * 100 End Function
escuse mais revoie les com précédent
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 Function PositionForm2(usf, rng) Dim Zooom#, PtToPx#, cadre#, usable# cadre = Application.Width - Application.UsableWidth cadre = IIf(Application.OperatingSystem 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 Wwidth = IIf(rng.Columns.Count > 1, rng.Width * (Zooom) - usable + cadre, usf.Width) Hheight = IIf(rng.Rows.Count > 1, rng.Height * Zooom - usable, 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
oui ça colle
c'est quoi le usable ?Citation:
Wwidth = IIf(rng.Columns.Count > 1, rng.Width * (Zooom) - usable + cadre, usf.Width)
désolé
donc maintenant occipons noude tes deux lignes suivantes
chez toi
il est facile de remplacer ton +10 par +cadre*2Code:
1
2 Wwidth = IIf(rng.Columns.Count > 1, (rng.Width * Z) + 10, usf.Width) Hheight = IIf(rng.Rows.Count > 1, (rng.Height * Z) + 5, usf.Height)
et donc ton +5 par +cadre
et donc chez moi
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)
il nous reste plus qu'a combiner ces 4 lignes en une pour le générique
usable tu peut l'enlever il sert plus a rien
je suis obligé de mettre en "-" pour que sa passeCode:
1
2 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)
bon ben chose étonnante c'est pareil pour nous deux
Ben un coup c'est + et un coup c'est -, mais ça marche
c'est normal les - a la place des + les "- -"="+"
change moi les + en moins la ou il faut chez toi sauf dans la ligne "cadre=iif........"
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 Function PositionForm2(usf, rng) Dim Zooom#, PtToPx#, cadre#, usable# cadre = Application.Width - Application.UsableWidth cadre = IIf(Application.OperatingSystem 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 + cadre 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
Problème sur le top
Pièce jointe 280839Code:ttop = .PointsToScreenPixelsY(rng.Top * PtToPx * Zooom) / PtToPx + cadre
Pièce jointe 280843Code:ttop = .PointsToScreenPixelsY(rng.Top * PtToPx * Zooom) / PtToPx - cadre
a oui c'est vrai tu n'en a pas besoins pour le top
non
voila ne change rien teste c'est tout
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 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
ouais ça colle et avec le zoom pas de problème non plus
voila on a maintenant une fonction compatible avec
W7 2007
W10 2007
W10 2010
W10 2013
W10 2016
demain je récupèrerais mon ancien PC portable si je trouve le chargeur est j'essaierais sur XP2003
on est les champions
et plus de données numérique en dur on prends tout dans excel sauf le 2.4 mais comme il est identique pour tous on le prendra pas en compte
Plus toi que moi, mais si tu as des expériences appel moi c'est très instructifCitation:
on est les champions