vbs 表格写入
在A1到A50中寻索变量name,然后在name所对应的地方的B写入mark例如:name=wemark=55we在表格中的A34处,就在B34中写入55...
在A1到A50中寻索变量name,然后在name所对应的地方的B写入mark
例如:
name =we mark=55
we在表格中的A34处,就在B34中写入55 展开
例如:
name =we mark=55
we在表格中的A34处,就在B34中写入55 展开
1个回答
展开全部
dim xlApp,xlWorkBook,xlSheet
dim iRowCount,iLoop,numAdd
set xlApp = CreateObject("Excel.Application")
xlApp.Visible = false
set xlWorkBook = xlApp.Workbooks.Open("c:\data.xls")
set xlSheet = xlWorkBook.Sheets("Sheet1")
iRowCount = xlSheet.usedRange.Rows.Count
For iLoop = 2 to iRowCount
numAdd=xlSheet.Cells(iLoop,1)+numAdd
next
xlSheet.Range("e2").value=iLoop
For i=1 to 10
xlSheet.range("d" & i).value=int(rnd*1000)
next
xlApp.cells(9,9)=995
xlWorkBook.Save
xlWorkBook.Close
xlApp.Quit
set xlSheet = Nothing
set xlWorkBook = Nothing
set xlApp = Nothing
msgbox(numAdd)
dim iRowCount,iLoop,numAdd
set xlApp = CreateObject("Excel.Application")
xlApp.Visible = false
set xlWorkBook = xlApp.Workbooks.Open("c:\data.xls")
set xlSheet = xlWorkBook.Sheets("Sheet1")
iRowCount = xlSheet.usedRange.Rows.Count
For iLoop = 2 to iRowCount
numAdd=xlSheet.Cells(iLoop,1)+numAdd
next
xlSheet.Range("e2").value=iLoop
For i=1 to 10
xlSheet.range("d" & i).value=int(rnd*1000)
next
xlApp.cells(9,9)=995
xlWorkBook.Save
xlWorkBook.Close
xlApp.Quit
set xlSheet = Nothing
set xlWorkBook = Nothing
set xlApp = Nothing
msgbox(numAdd)
追问
额,本人新手,变量name和变量mark在这里分别是什么变量?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询