form to show only once

sunshine076

Registered User.
Local time
Today, 04:59
Joined
Apr 6, 2009
Messages
160
So far this code is running fine however I have noticed that everytime I rerun the update for data it keeps showing the form while updating is there a way to hide it and have it show only once for each page that requires it.

Option Explicit
Private Sub process()
Dim ce As String
Dim AA As Range
Dim d As Integer
'.Cells.Locked = False
'.Range("A1:O4").Locked = True 'adjust range to suit
'.Protect Password:="macrotime"
'End With
Sheets("ToolChange").Select
Sheets("Toolchange").Unprotect Password:=P
Range("D1").Select
d = 4
ce = "y"

Do
Set AA = Range(Cells(1, d), Cells(48, d))
'Cells (row,column)
Cells(50, d).Value = Application.WorksheetFunction.CountIf(AA, ce)
ActiveCell.Offset(0, 1).Select

d = d + 1
Loop Until d = 12
Set AA = Nothing
Load LotForm
LotForm.Show vbModeless
Sheets("ToolChange").Calculate
End Sub
 
This is an Excel VBA question. You would get a better response if you move your thread to the Excel section of the forum.

In the meantime look into the ScreenUpdating method of the Application object.
 
I agree with vbaInet but I think what you need to look at is what happens in here...

Load LotForm
LotForm.Show vbModeless

I assume that you have a lot of code on a form which runs on the LOAD method and then when that is finished the form is shown. Are you showing it vbModeless for a reason like to stop further code from running?

Have a look at the properties of LotForm. Do you have a Hide property or something like that?

On a rerun you could do a LotForm.Hide and then at the end LotForm.Show
 

Users who are viewing this thread

Back
Top Bottom