cannot see text box

S

s_smith_iet

I have a text box in a userform equal a cell in one sheet while a
macro runs to show the percent of macro completed......
WHen the userform comes up it is white, like it is not completely
loading and I cannot see the textbox.

I have my code start when the userform is activated. Is there another
way to bring it up?
 
F

FSt1

hi
wild guessing here but if a form is not updating while a macro is running,
you may need to lace a few doevents throughout your code. the DoEvents
function yeilds code excution to the operating system(temporaryly) so that
the operating system can perform tasks in it's cache like update the screen.
look up DoEvents in VB hlep
for more info.
Regards
FSt1
 
S

s_smith_iet

Hey,

what I have is a folder where I open the files one at a time then when
I get all the info out of them I delete the file and open the next.
What I am using is count files.

First I count the all the files and put that number in a a cell then
in another cell I count every time the macro loops through the code
and count the files as they delete. I then invert the number and use
that as a percent and make a text box in a userform equal that cell.
Every loop I open the userform make it equal the cell then I turn on
the screen updating then turn off the screen updating then loop
through the code again. it may be crued but everything works but it
seems like the userform wont completely load while the macro runs.
 
F

FSt1

hi
i understand what you're doing. using a form as a progress meter. unique way
too. i never thought of doing it that way. i assume your update through a
linked cell.
but the problem is updating the form ie see the info there. did you try
DoEvents?
i did a form(personal msgbox) that was suppose to change color 3 time and
display a differnt message each time. screenupdate was never turned off and i
still had problems but DoEvents did the trick. your form is probably changing
much faster than mine.
another thing you may want to consider is use of the status bar as a
progress meter. i've had considerable luck with that.
see this site
http://www.cpearson.com/excel/StatusBar.htm
also here is some sample code i did using the status bar. it's do nothing
code.
in a blank worksheet, put 10000 numbers down column A. paste this code in a
standard module to see how it work. the numbers were changeing so fast the
first run, i added an if clause to only up date the status bar every 100
numbers.
Sub usestatusbar()
Dim cnt As Long 'SB
Dim rng As Range 'SB
Dim lrng As Range 'SB
Dim rcnt As Long 'SB
cnt = 0
cnt10 = 0

'find and count records in range
Set rng = Cells(65536, 1).End(xlUp) 'SB
Set lrng = Range(rng, rng.End(xlUp)) 'SB
rcnt = lrng.Rows.Count 'SB
Application.StatusBar = rcnt & " Records"
'events to measure progress
For Each cell In lrng
cell.Offset(0, 1).Value = "hi" 'dummy duty
cell.Offset(0, 1).Interior.ColorIndex = 40 'dummy duty
cnt = cnt + 1 'SB
cnt10 = cnt10 + 1
'update status bar
If cnt10 = 100 Then
cnt10 = 0
Application.StatusBar = cnt & " of " & rcnt
End If
Next cell
MsgBox "Done!"
Application.StatusBar = False
End Sub

regards
FSt1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top