P
purplehaz
I have a spreadsheet that has a button that pops up a form. On the form you
enter in the row number and comments into text boxes. Upon clicking the ok
button the below code runs. It copies and pastes text from a text box in the
form to the row and cell designated. It works great, but the problem I have
is I have to do row 6 thru row 455. So I copy and paste the code and change
the row to seven, then copy and paste again and change to 8....etc... all
the way to row 455. When I run it I get a Procedure To Large compile error.
Says the Sub procudure must be smaller than 64k. I can only get it up to row
79 for it to work. Any code after that and I get the error. Any ideas on how
I can get this to work? Thanks.
Private Sub cmdOK_Click()
If TextBoxRow.Text < 6 Then
MsgBox "Bids and Comments must start on Row 6. Rows 1-5 are reserved for the
program.", vbOKOnly + vbCritical, "Error!"
End If
If TextBoxRow.Text = 6 Then
With ActiveSheet
If .Range("AO6").Text = "" Then
.Range("AO6").Formula = TextBoxComment1.Text
ElseIf .Range("AO6").Text <> "" Then
If .Range("AP6").Text = "" Then
.Range("AP6").Formula = TextBoxComment1.Text
ElseIf .Range("AP6").Text <> "" Then
If .Range("AQ6").Text = "" Then
.Range("AQ6").Formula = TextBoxComment1.Text
ElseIf .Range("AQ6").Text <> "" Then
If .Range("AR6").Text = "" Then
.Range("AR6").Formula = TextBoxComment1.Text
ElseIf .Range("AR6").Text <> "" Then
If .Range("AS6").Text = "" Then
.Range("AS6").Formula = TextBoxComment1.Text
ElseIf .Range("AS6").Text <> "" Then
MsgBox "At this time comments are limited to 5 fields! See
the system administrator if more comment fields are needed.", vbOKOnly +
vbCritical, "Error!"
End If
End If
End If
End If
End If
End With
End If
End Sub
enter in the row number and comments into text boxes. Upon clicking the ok
button the below code runs. It copies and pastes text from a text box in the
form to the row and cell designated. It works great, but the problem I have
is I have to do row 6 thru row 455. So I copy and paste the code and change
the row to seven, then copy and paste again and change to 8....etc... all
the way to row 455. When I run it I get a Procedure To Large compile error.
Says the Sub procudure must be smaller than 64k. I can only get it up to row
79 for it to work. Any code after that and I get the error. Any ideas on how
I can get this to work? Thanks.
Private Sub cmdOK_Click()
If TextBoxRow.Text < 6 Then
MsgBox "Bids and Comments must start on Row 6. Rows 1-5 are reserved for the
program.", vbOKOnly + vbCritical, "Error!"
End If
If TextBoxRow.Text = 6 Then
With ActiveSheet
If .Range("AO6").Text = "" Then
.Range("AO6").Formula = TextBoxComment1.Text
ElseIf .Range("AO6").Text <> "" Then
If .Range("AP6").Text = "" Then
.Range("AP6").Formula = TextBoxComment1.Text
ElseIf .Range("AP6").Text <> "" Then
If .Range("AQ6").Text = "" Then
.Range("AQ6").Formula = TextBoxComment1.Text
ElseIf .Range("AQ6").Text <> "" Then
If .Range("AR6").Text = "" Then
.Range("AR6").Formula = TextBoxComment1.Text
ElseIf .Range("AR6").Text <> "" Then
If .Range("AS6").Text = "" Then
.Range("AS6").Formula = TextBoxComment1.Text
ElseIf .Range("AS6").Text <> "" Then
MsgBox "At this time comments are limited to 5 fields! See
the system administrator if more comment fields are needed.", vbOKOnly +
vbCritical, "Error!"
End If
End If
End If
End If
End If
End With
End If
End Sub