I need some help here. Hopefully it won’t be too confusing.
I have the below code that code is supposed to be lookingthrough the range, setting a couple of variable, and then deleting the last usedcell in a range but the problem is it keeps bringing up a userform (frmTime1)while the code is running and I do not want it to.
The problem is within this range, when any of the cells areselected by the user (using Worksheet_SelectionChange), I have a userform that is supposed to pop up to allow theuser to enter their data.
Is there a way to declare these variable which would be thelast data in range(s) DateCol and EndCol and then would also find the last data inrange StartCol and clear contents WITHOUT bringing up the userform?
-OR-
Is there a way to close the userform that pops up after ispops up with in the code?
I have the below code that code is supposed to be lookingthrough the range, setting a couple of variable, and then deleting the last usedcell in a range but the problem is it keeps bringing up a userform (frmTime1)while the code is running and I do not want it to.
The problem is within this range, when any of the cells areselected by the user (using Worksheet_SelectionChange), I have a userform that is supposed to pop up to allow theuser to enter their data.
Is there a way to declare these variable which would be thelast data in range(s) DateCol and EndCol and then would also find the last data inrange StartCol and clear contents WITHOUT bringing up the userform?
-OR-
Is there a way to close the userform that pops up after ispops up with in the code?
Code:
[FONT=Calibri][SIZE=3][COLOR=#000000]Public globDate As Double, globTime As Double[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Sub Button10_Click()[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]
'get the last end time for nextjob start time[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]
Dim xLastRow As Long[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000] WithApplication.ActiveSheet.Range("EndTimeCol")[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000] xLastRow =.Cells(.Rows.Count, "a").End(xlUp).Activate[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000] End With[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Unload frmTime1[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000] globTime =ActiveCell.Value[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]'get the last end date for the next job start date.[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]
Dim xLastRow2 As Long[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000] WithApplication.ActiveSheet.Range("DateCol")[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000] xLastRow2 =.Cells(.Rows.Count, "a").End(xlUp).Activate[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000] End With[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000] globDate =ActiveCell.Value[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Unload frmTime1[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]
[FONT=Calibri][SIZE=3][COLOR=#000000]'clear the last copied start time[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]Dim xLastRow3 As Long[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]
WithApplication.ActiveSheet.Range("StartCol")[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000] xLastRow3 =.Cells(.Rows.Count, "a").End(xlUp).MergeArea.ClearContents[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000] End With[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000] [FONT=Calibri][SIZE=3][COLOR=#000000] Unload frmTime1[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]End Sub[/COLOR][/SIZE][/FONT]
Last edited: