• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

[UserForm] My macro isn't operating very well. Could you tell me why & how to fix it?

dourpil

Member
Hi all!

I'm working on my 2nd ever VBA project, and going through some difficulties ATM.

Please refer to the attached file!

I have a userform that is to be used for data entry: it gathers username, date, room number (= "Salle" sometimes in my file), and the results of several points in a room for 2 types of test (0,5µ & 5µ).

The user enters each point one by one, and a listbox is filled automatically. When a room is done, clicking the button "Encoder" (translation: "data entry") sends the content of the listbox in the worksheet "Data".

The issue I have ATM is that clicking that button "Encoder" seems very slow for the little calculations it should do. Besides, the UserForm (that has been unloaded and shown again) is now buggy if you drag it around (at least on my computer, moving the userform does something like that: http://i.stack.imgur.com/BJGBH.png )

Do you know why it acts that way? Am I using uneffective ways of manipulating my data?
As I said, it's my 2nd VBA work so I have very little knowledge of proper coding but I'm very excited to learn new stuff!


Also, I've had trouble repositioning my cursor in the data entry textbox after clicking OK. The function "setfocus" didn't seem to be working in my case and I had to add a TbInput_Keydown procedure that I don't fully understand.



Thanks a lot for reading me ! I hope you can give me some hints and advices!

Simon
 

Attachments

  • file upload - userform question.xlsm
    39.6 KB · Views: 5
Hi Simon,

I don't see any problem on my system, it is not slowing, nor it is leaving trailing image when I am dragging the userform.

Regards,
 
Thanks Somendra for trying that out.
I have to ask though.. Did you just try the userform or did you select a room, enter some data and click "Encoder" before trying it? I guess you followed that procedure but you didn't mention it.

That's odd. When I'm doing it, I clearly see if for example I have a room with 2 points (so 2x2 = 4 lines copied as data), in the bottom right corner where the "Calculating ... x%" satus is, 4 distinct calculations for a total time of ~1 second.. Then the refreshed userform is buggy as I described.
 
Found the solution:

I had automatic calculation turned ON! I'll have to auto-turn it off in my code... Dumb me!

-

Clicking&dragging the UserForm after data entry is still buggy though.. :(

Aaand EDIT: Found the "solution" aswell. The issue was coming from Application.ScreenUpdating

It should've worked since I disabled it to unload & show the userform then set it back to TRUE.. But I removed both lines and the issue is gone!
 
Last edited:
Back
Top