The overflow issues has been posted about before but I can't solve it as it relates to my code. Could someone please help me print data to a table without any overflow/variable issues?
Code:
Sub PrintDataTable()
'General variables
Dim symCell
Dim rngCell
Dim dateVal
Dim volVal
Dim symbol As String
Dim lastDataRow As Integer
Dim rng As Range
Sheets("BB Prod Data").Activate
For Each symCell In Sheets("Prod Data").Range("A1:DZU1")
Sheets("Prod Data").Activate
If symCell <> "" Then
symbol = symCell.Text
With Sheets("Prod Data")
Set rng = .Range(.Cells(symCell.Offset(3, 0).Row, symCell.Column), .Cells(symCell.End(xlDown).Row, symCell.Column))
End With
For Each rngCell In rng
dateVal = rngCell.Value
volVal = rngCell.Offset(0, 1).Value
Sheets("DataTable").Activate
lastDataRow = Sheets("DataTable").Range("B1040000").End(xlUp).Row
Sheets("DataTable").Range("B" & lastDataRow + 1).Value = symbol
Sheets("DataTable").Range("C" & lastDataRow + 1).Value = dateVal
Sheets("DataTable").Range("D" & lastDataRow + 1).Value = volVal
'Sheets("Prod Data").Activate
Next rngCell
End If
Next symCell
Debug.Print "DONE"
End Sub