是有这样的问题,这是Excel的问题
解决的方法是在Excel的菜单项 工具-->宏-->VB编辑器 中编写宏代码

解决方案 »

  1.   

    To: jianghuxiaozi(江湖小子) 
    兄弟,我们上次已经见过了吧,我记得还给你分了,
    要在Excel中编码,不太现实,因为这些Excel文件是用户输入资料用的,
    而且我也不会呀,能贴出宏代码来吗?还会给分的。
    有更好的方法就更好了!
      

  2.   

    i don‘t know。but up。
      

  3.   

    To: Gongshl(阿单) 
       你可以先在磁盘的某个目录下用Excel建立模板文件,同时把宏代码写入模版文
    件中,当用户要用Excel输入资料的时候,先把模版文件拷贝成用户需要的文件
    (用户在拷贝后的文件中操作,不能操作模版文件)。具体的代码需要看具体的
    需求,下面是我在求一列数据的平均值时用到的代码,不知有没有用?Public Sub getCellAvage(ASheet As Worksheet, beginRow, beginCol, endRow, endCol, resultRow, resultCol As Integer)
      'ASheet -- Your Excel file Work Sheet.
      'beginRow,beginCol -- the left top cell's position
      'EndRow, end Col -- the Right Buttom cell's Position
      'ResultRow, resultCol -- then cell which you place your value
      
      Dim intRow, intCol, intRowLoop, intColLoop, intCount As Integer
      Dim relCount, relTemp As Double
        relCount = 0
        intCount = 0
        For intRowLoop = beginRow To endRow
          For intColLoop = beginCol To endCol
            intRow = intRowLoop
            intCol = intColLoop
            If Trim(ASheet.Cells(intRow, intCol).Value) <> "" Then
              relTemp = ASheet.Cells(intRow, intCol).Value
              relCount = relCount + relTemp
              intCount = intCount + 1
            End If
          Next intColLoop
        Next intRowLoop
        If intCount > 0 Then
           ASheet.Cells(resultRow, resultCol).Value = relCount / intCount
        Else
           ASheet.Cells(resultRow, resultCol).Value = ""
        End If
    End Sub