Dear Gents,
The following code can run well sometimes,
but after run other macro , following code show run time error 91: Object variable or with block variable not set
Would you please help me to figure out this problem?
Thanks.
The following code can run well sometimes,
but after run other macro , following code show run time error 91: Object variable or with block variable not set
Would you please help me to figure out this problem?
Thanks.
Code:
Option Explicit
Public rngA, rngB, cell As Range
Public a, B, C, D, k, VD, VC, PtS, Sx, Vt, PtN, Age, Nat, OH, TT, Re, Inj, IL, DS As Double
Sub SearchCol()
VD = Sheet1.Cells.Find(what:="VisitDay").Column
VC = Sheet1.Cells.Find(what:="VisitCase").Column
PtS = Sheet1.Cells.Find(what:="PtState").Column
Sx = Sheet1.Cells.Find(what:="Sex").Column
Vt = Sheet1.Cells.Find(what:="VisitTime").Column
PtN = Sheet1.Cells.Find(what:="PtName").Column
Age = Sheet1.Cells.Find(what:="Age").Column
Nat = Sheet1.Cells.Find(what:="Nation").Column
OH = Sheet1.Cells.Find(what:="occ").Column
TT = Sheet1.Cells.Find(what:="TreatmentType").Column
Re = Sheet1.Cells.Find(what:="Result").Column
Inj = Sheet1.Cells.Find(what:="InjuryOrNot").Column
IL = Sheet1.Cells.Find(what:="InjuryLocation").Column
DS = Sheet1.Cells.Find(what:="DiseaseSystem").Column