PDA

View Full Version : [SOLVED] prevent form to make the sheet scroll?



ValerieT
08-11-2014, 02:04 AM
Hello

I've got a form with property: set to be on the top left corner of the screen. (tried with any setting, same problem)
I can call it by double click in any cells of the sheet.

If I am in column AA for example and then double click to call the form, it scroll back to A because of it....
in other words, is there a way to set a "relative" top left position for the form?

Thanks

mancubus
08-11-2014, 04:09 AM
hi.
setting StartUpPosition property of the UserForm to Windows Default may help.

ValerieT
08-11-2014, 05:43 AM
nope, I tried all possible setup for "StartUpPosition", same results.. I also tried with and without values in "Left" and "Top", thinking it was a combinaison of properties, but it changes nothing

snb
08-11-2014, 05:47 AM
startuppostion: 0


Private Sub UserForm_Initialize()
Left = ActiveCell.Offset(, 1).Left - ActiveWindow.ActivePane.VisibleRange.Left + 30 * Abs(ActiveWindow.DisplayHeadings)
Top = ActiveCell.Offset(1).Top + 27 * Abs(Application.DisplayFormulaBar) + 27 * Abs(ActiveWindow.DisplayHeadings) + 27 * Abs(ActiveWindow.DisplayRuler)
End Sub

ValerieT
08-12-2014, 01:24 AM
Thanks snb, I tried, doesn't work. The form take the offset into account (it move a little bit each time) but doesn't prevent the scrolling back to top left.. (if I understand your code, it doesn't recognise VisibleRange as Visible screen)

As it is not a must but a nice to have, it is OK if you don't have more time to spend on this...

snb
08-12-2014, 01:40 AM
I can't see what other code is in your form.

So the best way is....... to post your sample file.

ValerieT
08-12-2014, 02:48 AM
I can't upload anything with my company security high level.. :( but the good news is that I found the problem... thanks to you, I've checked the rest of the code and found a stupid cells(1,1).select lost in the sheet code..

So sorry and so happy it works! you're the best...

snb
08-12-2014, 02:56 AM
Please, don't mention it to others.... ;) ;)