向各位大神请教一个如何将Excel单元格中的数据显示在标签上,并随鼠标的点击而改变内容
向各位大神请教一个如何将Excel单元格中的数据显示在标签上,并随鼠标的点击而改变内容,我是一名新手,我的代码如下,大家给看看如何修改
Dim exapp As New Excel.Application
Dim exb As Excel.Workbook
Dim exsh As Excel.Worksheet
Dim dyg As Excel.Range
Dim i As Integer
Private Sub Form_Load()
i = 1
Set exapp = Create.Excel.appliction
Set exb = exapp.Workbooks.Open(e \ "book.xlsx")
Set exsh = exb.Worksheets("sheet1")
Set dyg = exsh.Cells(i, 1)
End Sub
Private Sub Label1_Click()
If i <= 10 Then
Label1.Caption = dug.Value
i = i + 1
Else
Label1.Caption = "结束"
exapp.Workbooks.Close
exapp.Quit
Set exapp = Nothing
End Sub