synergy16
Active Member
- Joined
- Mar 17, 2016
- Messages
- 422
- Office Version
- 365
- Platform
- Windows
can anybody tell me when the code (written in red) would cause a run time error 6....overflow? its not that big of a spreadsheet.
Code:
'***************************THIS SUB WILL POPULATE THE CURRENT PART NUMBERS AT A SPECIFIC VENDOR********************************Private Sub vendorLB_Click()
Dim prtNumsV() As Variant
Dim cntrV, t, y, venCounter As Variant
Dim oPartFlag As Boolean
Erase prtNumsV
arrivedTb.Text = ""
partNumLB.Clear
ListBox1.Clear
'check to see if arrived parts filter box is checked
If partFilter = True Then
Call vendorLBn_Click
Exit Sub
End If
'clear box data
serialNumTB = ""
partQtyTB = ""
partRevTB = ""
lotBatchTB = ""
jobProOrderTB = ""
supplierTB = ""
venPicked = vendorLB.Value
'get number of populated rows total
Dim data As Range
Dim r As Variant
Dim k As Variant
[COLOR=#ff0000] Set data = Sheet1.Range("c1:c" & Range("c" & Rows.Count).End(xlUp).Row)[/COLOR]
[COLOR=#ff0000] cntrV = 0[/COLOR]
[COLOR=#ff0000] For Each r In data[/COLOR]
[COLOR=#ff0000] cntrV = cntrV + 1[/COLOR]
[COLOR=#ff0000] If r.Offset(1) = vbNullString And r.Offset(2) = vbNullString Then[/COLOR]
[COLOR=#ff0000] End If[/COLOR]
[COLOR=#ff0000] Next r[/COLOR]
'get number of times selected customer appears on sheet
y = 0
venCounter = 0
For t = 1 To cntrV + 1
If UCase(venPicked) = UCase(Cells(t, 9)) And UCase(Mid(Cells(t, 12), 1, 7)) <> "ARRIVED" Then
venCounter = venCounter + 1
End If
Next
On Error Resume Next