是有这样的问题,这是Excel的问题
解决的方法是在Excel的菜单项 工具-->宏-->VB编辑器 中编写宏代码
解决的方法是在Excel的菜单项 工具-->宏-->VB编辑器 中编写宏代码
解决方案 »
- BDE用.INI 文件 連接數據庫
- 什么是e-r图?总听说,又不太明白!
- 开放源代码的编译器 OpoenPL/G V0.02,有兴趣的欢迎提意见.
- 我想实现在给ListBox1增加值的时侯想添加唯一的值。。。
- 如何让treeview的节点响应事件,如单击双键可以修改,或单击将其内容转到一个edit中
- 谁有delphi6控件的属性,使用方法
- 小菜的问题:字符串操作~~
- delphi里如何实现excel 表格替代dbgrid!火急!!!
- 在DELPHI中使用ACCESS数据库是不是一定要装ACCESS呀??
- 字段个数、名称不固定,如何做报表?
- Socket 問題
- 談談Quantum硬盤,怎么老是坏!!!
兄弟,我们上次已经见过了吧,我记得还给你分了,
要在Excel中编码,不太现实,因为这些Excel文件是用户输入资料用的,
而且我也不会呀,能贴出宏代码来吗?还会给分的。
有更好的方法就更好了!
你可以先在磁盘的某个目录下用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