Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
userform problems
Hi,
Hi i have a program with multiple userforms, the user only gets to use the forms as there interface. When using userform2 i some times get the following error, "the object has disconnected from its clients server" when the debug button is pressed it always goes to one of thelines that load the form It does not seem to happen at a specific point. Only one userform seems to have a problem below is some code that is assigned to one of the command buttons on the userform. The form displays a list box with data in it. The user selects a row from that data, there are several command buttons that take that data off the list and pastes to another part of the spreadsheet. each command button assigns some different data to the row. When the program takes the daat off the list the userform unloads and reloads when its pasted somewhere else, so that the row the user selects disapears in front of them. It seems as those the program is running out of memory every now and then and just crashes. Hope this helps if not i could always e-mail the programm to someone to have alook. code for command button 1 Dim FIVEFOUR Dim answer Application.ScreenUpdating = False Sheets("menu").Select Call comfirststage If ActiveCell.Value = "" Then Sheets("MENU").Select If ActiveCell.Value = "" Then Application.ScreenUpdating = True If ActiveCell.Value = "" Then Exit Sub FIVEFOUR = InputBox(PROMPT:="How Many?") If FIVEFOUR = "" Then MsgBox Title:="POLETRACKER", PROMPT:="You have not entered a number. If you still wish to complete this job then select a unit again and ensure you type in the quantity" If FIVEFOUR = "" Then Call clearback If FIVEFOUR = "" Then Application.ScreenUpdating = True If FIVEFOUR = "" Then Exit Sub Sheets("COM").Select Range("a2").Select ActiveCell.Offset(0, 9).Activate ActiveCell.Value = FIVEFOUR ActiveCell.Offset(0, -9).Activate answer = MsgBox(PROMPT:="another unit?", Buttons:=vbYesNo + vbQuestion) If answer = vbYes Then Sheets("menu").Select If answer = vbYes Then Application.ScreenUpdating = True If answer = vbYes Then Exit Sub If answer = vbNo Then Call proactivecom code for COMFIRSTSTAGE Sub comfirststage() Sheets("COM").Select Range("A1").Select If ActiveCell.Value = "" Then MsgBox Title:="POLETRACKER", PROMPT:="You have not selected a job. Please retry" If ActiveCell.Value = "" Then Exit Sub Sheets("COM").Select clear = Range("a1") Sheets("DISPLAY").Select Range("A1").Select Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:=clear Rows("2:700").Select Selection.Copy Sheets("COM").Select Range("a3").Select ActiveSheet.Paste Range("A3:h3").Select Selection.Copy Range("a2").Select ActiveSheet.Paste CODE FOR PROACTIVECOM Sub proactivecom() Dim checker As Integer Dim UNIT As Integer checker = 0 UNIT = 0 Application.ScreenUpdating = False Sheets("COM").Select Range("A2").Select Do While checker < 20 If ActiveCell.Value < "" Then UNIT = UNIT + 1 ActiveCell.Offset(0, 1).Activate checker = checker + 1 Loop If UNIT < 1 Then MsgBox Title:="POLETRACKER", PROMPT:="You cannot complete this job as you have not assigned any units!" If UNIT < 1 Then ActiveCell.Offset(0, -20).Activate If UNIT < 1 Then Selection.End(xlToLeft).Select If UNIT < 1 Then Exit Sub Range("a2").Select UserForm6.Show End Sub CODE FOR CLEARBACK Sub clearback() Sheets("COM").Select Rows("1:1").Select Application.CutCopyMode = False Selection.ClearContents Rows("2:2").Select Application.CutCopyMode = False Selection.ClearContents Range("A1").Select Sheets("DISPLAY").Select Range("A1").Select Selection.AutoFilter Selection.AutoFilter Field:=1 Range("A1").Select Sheets("MENU").Select Application.ScreenUpdating = True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
userform problems | Excel Programming | |||
userform problems | Excel Programming | |||
userform problems | Excel Programming | |||
UserForm Problems | Excel Programming | |||
More UserForm problems | Excel Programming |