Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default can't move UserForm with the mouse

I have a userform with comcobox, two textbox and some buttons.
If I run this macro (from button in userform) shown below, and then try
to move the UserForm with the mouse, the UserForm getting spread all
over the screen(Following the mouse).Looks like it's copying itself for
every movment.
Any Suggestion why? Everything works fine, but is not possible to look
at the cells behind the userform, by moving it.


Private Sub CommandButton3_Click()
ActiveSheet.Unprotect Password:=""
Application.ScreenUpdating = False

Dim c As range
Set c = ActiveCell
For Each c In ActiveSheet.range("B4:B53")
If Not IsEmpty(c) Then GoTo line1 Else GoTo line2
line1:
Next c
line2:
ComboBox1.Value = c.Offset(0, -1).Value
ComboBox1.SetFocus

ActiveSheet.Protect Password:="", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub


*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 747
Default can't move UserForm with the mouse

This is normally what happens when screen updating is set to false. Your code
sets screen updating to false and does not reset it back to true. Suggested
rewrite:

Private Sub CommandButton3_Click()
Dim c As Range
ActiveSheet.Unprotect
Application.ScreenUpdating = False
For Each c In Range("B4:B53")
If IsEmpty(c) Then Exit For
Next c
ComboBox1.Value = c.Offset(0, -1).Value
ComboBox1.SetFocus
Application.ScreenUpdating = True
ActiveSheet.Protect
End Sub

"Axel" wrote:

I have a userform with comcobox, two textbox and some buttons.
If I run this macro (from button in userform) shown below, and then try
to move the UserForm with the mouse, the UserForm getting spread all
over the screen(Following the mouse).Looks like it's copying itself for
every movment.
Any Suggestion why? Everything works fine, but is not possible to look
at the cells behind the userform, by moving it.


Private Sub CommandButton3_Click()
ActiveSheet.Unprotect Password:=""
Application.ScreenUpdating = False

Dim c As range
Set c = ActiveCell
For Each c In ActiveSheet.range("B4:B53")
If Not IsEmpty(c) Then GoTo line1 Else GoTo line2
line1:
Next c
line2:
ComboBox1.Value = c.Offset(0, -1).Value
ComboBox1.SetFocus

ActiveSheet.Protect Password:="", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub


*** Sent via Developersdex http://www.developersdex.com ***

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default can't move UserForm with the mouse



Thank you very much Greg!

That worked!

Aksel

*** Sent via Developersdex http://www.developersdex.com ***
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to move a row using mouse but not overwrite other row? Oneswolf Excel Discussion (Misc queries) 2 April 13th 06 08:12 PM
mouse move event David Excel Programming 0 August 22nd 05 11:21 AM
Is clicking on the tab with my mouse the only way to move from on. Elizabeth Excel Worksheet Functions 2 March 21st 05 06:43 PM
move mouse or cursorpos BrianB Excel Programming 0 January 21st 04 03:56 PM
cursor or mouse move matt dunbar Excel Programming 1 January 16th 04 02:58 PM


All times are GMT +1. The time now is 10:51 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"