Option Explicit Dim rowc, cc, columnC As Integer Dim last_row as integer Dim i as integer Dim stock_code as integer Sub helloworld() ' On Error GoTo eh WriteStatus.run "init config" Config.init WriteStatus.run "init config done" ' find last row last_row = GetLastRow.run(11) 'last_row = 23 Debug.print last_row for i = ROW_START to last_row stock_code = CInt(ReadStockCode.run(i)) if (stock_code > -1) then temp = FetchAaStock.run(stock_code) WriteStatus.run "updateing stock code " & CStr(stock_code) & "..." WriteStockName.run i, CStr(temp(IDX_STOCK_NAME)) Write_10DayMovingAverage.run i, CStr(temp(IDX_10_DAY_MOVING_AVERAGE)) Write_50DayMovingAverage.run i, CStr(temp(IDX_50_DAY_MOVING_AVERAGE)) Write_100DayMovingAverage.run i, CStr(temp(IDX_100_DAY_MOVING_AVERAGE)) Write_250DayMovingAverage.run i, CStr(temp(IDX_250_DAY_MOVING_AVERAGE)) WriteRsi_10.run i, CStr(temp(IDX_10_DAY_MOVING_AVERAGE)) WriteRsi_14.run i, CStr(temp(IDX_50_DAY_MOVING_AVERAGE)) WriteRsi_20.run i, CStr(temp(IDX_50_DAY_MOVING_AVERAGE)) WriteMACD_8_17Days.run i, CStr(temp(IDX_MACD_8_17_DAYS)) WriteMACD_12_25Days.run i, CStr(temp(IDX_MACD_12_25_DAYS)) WriteEarningsPerShare.run i, CStr(temp(IDX_EARNINGS_PER_SHARE)) WriteFundFlow.run i, CStr(temp(IDX_FUND_FLOW)) WritePERatioExpected.run i, CStr(temp(IDX_P_E_RATIO_EXPECTED)) WriteShortSellingAmountRatio.run i, CStr(temp(IDX_SHORT_SELLING_AMOUNT_RATIO_)) ' WriteStockCode.run i, CStr(temp(IDX_STOCK_CODE)) WriteStockPrice.run i, CStr(temp(IDX_STOCK_PRICE)) WriteYield.run i, CStr(temp(IDX_YIELD)) WriteStatus.run "update stock code " & CStr(stock_code) & " done" else WriteStockName.run i, CStr("stock code is empty") end if next i ' debug.print test WriteStatus.run "update all stock code done" Done: Debug.Print "hello done" Exit Sub eh: Debug.Print "hello error" End Sub