1. 首页
  2. 股票

excel vb 股票分析(vb操作excel处理数据)

一、vb操作excel处理数据

excel vb 股票分析

建一个command1,
Private Sub Command1_Click()
Dim VBExcel As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
dim i as integer
Set VBExcel = New Excel.Application
Set xlBook = VBExcel.Workbooks.Open(“此处写你的EXL文件名的绝对地址”)
Set xlSheet = xlBook.Worksheets(“sheet1”)
xlSheet.Activate
for i=1 to 100
xlSheet.cells(i,2)=xlSheet.cells(i,1)*5 +1.3
next i
xlBook.save
xlBook.close
end sub

二、VB实现Excel

excel vb 股票分析

可以用IF函数套用ISERROR函数解决
=if(iserror(VLOOKUP(E1,INDIRECT(“‘E:\智能查询系统\智能查询系统数据库\资金项\[“&智能查询系统!B2&”]Sheet1’!$A$1:$G$19″),2,0)),””,VLOOKUP(E1,INDIRECT(“‘E:\智能查询系统\智能查询系统数据库\资金项\[“&智能查询系统!B2&”]Sheet1’!$A$1:$G$19″),2,0))

原创文章,作者:爱视财经,如若转载,请注明出处:https://www.ishizhuan.com/archives/66918.html