G
Guest
I have a Sub that dumps information into a worksheet. When a certain amount a
data is dumped, the routine makes a call to another sub to find a clear cell
and then it continues. My range is only from $L$19 to $L$45 and I would like
it if I could use the "new cell" routine to force the termination of the data
dump routine when the range has been exceeded. Possible?
Here's the "new cell" code:
Sub newCell()
Dim whiteSpace As Object
Dim curCell As Integer
Set whiteSpace = CreateObject("VBScript.RegExp")
whiteSpace.IgnoreCase = True
whiteSpace.Pattern = "^\s*$"
If ActiveSheet.name <> "myForm" Then Sheet2.Activate
If Not ActiveCell.Address = "$L$19" Then Range("L19").Select
For curCell = 19 To 45
If (whiteSpace.test(ActiveCell.value)) Then
Exit For
ElseIf curCell > 45 Then
MsgBox "No more line entries available." & _
Chr(13) & "Please combine your entries and resubmit."
Exit For
Else
ActiveCell.Offset(1, 0).Select
End If
Next
End Sub
data is dumped, the routine makes a call to another sub to find a clear cell
and then it continues. My range is only from $L$19 to $L$45 and I would like
it if I could use the "new cell" routine to force the termination of the data
dump routine when the range has been exceeded. Possible?
Here's the "new cell" code:
Sub newCell()
Dim whiteSpace As Object
Dim curCell As Integer
Set whiteSpace = CreateObject("VBScript.RegExp")
whiteSpace.IgnoreCase = True
whiteSpace.Pattern = "^\s*$"
If ActiveSheet.name <> "myForm" Then Sheet2.Activate
If Not ActiveCell.Address = "$L$19" Then Range("L19").Select
For curCell = 19 To 45
If (whiteSpace.test(ActiveCell.value)) Then
Exit For
ElseIf curCell > 45 Then
MsgBox "No more line entries available." & _
Chr(13) & "Please combine your entries and resubmit."
Exit For
Else
ActiveCell.Offset(1, 0).Select
End If
Next
End Sub