Hi Ozgrid Experts,
I'm new to VBA Excel and I'm currently working on this little stats calculator but I'm stuck on my Tabstrip Change Event. I'm getting an error when I'm trying to read value from a table.
First load is ok. When I open the form it will show no data on the first tab then if I change to any tab then go back to first tab it will load the values without a problem, but after I change to another tab and go back again to the first tab, it will throw a Could Not Set The Value Property error.
Just to give you an idea of what I want to do. The user will enter data from various controls and it'll save those data a table in my 'Calc' sheet then the macro will pull those data again when the tab is active again. Hopefully I making any sense. It's basically a little database that will be use to record the user input. Thanks!
Private Sub myTab_Change()
Dim arrData, c As Long, i As Long
arrData = Worksheets("CALC").ListObjects("tbl_stats").DataBodyRange
i = myTab.SelectedItem.Index + 1
For c = LBound(arrData) To UBound(arrData)
If c = i Then
cbxItem.Value = arrData(c, 1)
cbxItemLvl.Value = arrData(c, 2)
cbxAttrb1.Value = arrData(c, 3)
tbxAttrb1.Value = arrData(c, 4)
cbxAttrb2.Value = arrData(c, 5)
tbxAttrb2.Value = arrData(c, 6)
cbxAttrb3.Value = arrData(c, 7)
tbxAttrb3.Value = arrData(c, 8)
cbxAttrb4.Value = arrData(c, 9)
tbxAttrb4.Value = arrData(c, 10)
lblBns.Caption = arrData(c, 11)
lblBnsVal.Caption = arrData(c, 12)
End If
Next c
End Sub
Display More