When this step is reached, "Data1 = Str(F1.Cells(x, 1))" I get the error "Type mismatch." It only happens when the input data changes from a string of numbers stored as text "6666666" to "wafer test 112608"
Is there a better declaration for Data1?
Public Ary1() As String
Dim Data1 As String
Public NumBtchs As Integer
Public ExtractMethod
Sub PullAllBatchData()
ExtractMethod = 1
Workbook_Open
End Sub
Public Sub PullManualBatchData()
'Need to define Ary1 as a public array as it will be used in another Module
'ExtractMethod will define in other modules how to handle the data extraction
ExtractMethod = 2
'Defines F1 as the active sheet and activates it.
Set F1 = ActiveWorkbook.ActiveSheet
F1.Activate
'Need to define what the last row in Column A
lastrow1 = F1.Range("A" & Rows.Count).End(xlUp).Row
ReDim Ary1(lastrow1, 1)
NumBtchs = 0
For x = 1 To lastrow1
Data1 = Str(F1.Cells(x, 1))
F1.Cells(x, 1).Activate 'Cell needs to be activated for next line
If IsEmpty(ActiveCell.Value) Then Data1 = ""
If Data1 <> "" Then NumBtchs = NumBtchs + 1: Ary1(NumBtchs, 1) = Data1
Next
Workbook_Open
End Sub
Is there a better declaration for Data1?
Public Ary1() As String
Dim Data1 As String
Public NumBtchs As Integer
Public ExtractMethod
Sub PullAllBatchData()
ExtractMethod = 1
Workbook_Open
End Sub
Public Sub PullManualBatchData()
'Need to define Ary1 as a public array as it will be used in another Module
'ExtractMethod will define in other modules how to handle the data extraction
ExtractMethod = 2
'Defines F1 as the active sheet and activates it.
Set F1 = ActiveWorkbook.ActiveSheet
F1.Activate
'Need to define what the last row in Column A
lastrow1 = F1.Range("A" & Rows.Count).End(xlUp).Row
ReDim Ary1(lastrow1, 1)
NumBtchs = 0
For x = 1 To lastrow1
Data1 = Str(F1.Cells(x, 1))
F1.Cells(x, 1).Activate 'Cell needs to be activated for next line
If IsEmpty(ActiveCell.Value) Then Data1 = ""
If Data1 <> "" Then NumBtchs = NumBtchs + 1: Ary1(NumBtchs, 1) = Data1
Next
Workbook_Open
End Sub