vb.net - vb.net 做而 excel 单元格值不是“测试值”
问题描述
我是一个新的 VB.net 用户(完全自学)。
我正在尝试向下搜索 excel 工作簿的 A 列(从“A1”开始)以检查单元格内容。在找到一个特定值时,我想用 msgbox 输出它所在的单元格。
任何人都可以帮助我如何编码。
解决方案
玩了一天的各种东西,终于搞定了!!!
我是如何做到的 - 现在我已经解决了它看起来很简单:
Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
' For the first sheet in an excel workbook
xlWorkSheet = CType(objApp.Sheets(1), Microsoft.Office.Interop.Excel.Worksheet)
Dim strSheetName As String = xlWorkSheet.Name
' ***** Find the row with "Ambient Temp (C)" as its header
AmbientRange = objAppDeckCalc.Worksheets(strSheetName).Range("a1")
TempValue = AmbientRange.Value
Do While TempValue <> "Ambient Temp (C)"
AmbientRange = AmbientRange.Offset(1, 0)
TempValue = AmbientRange.Value
CountRow = CountRow + 1
If CountRow = 100 Then
MsgBox("Fields Not Named Correctly!")
End
End If
Loop
MsgBox("Ambient Temp (C) - CountRow - " & CountRow)
推荐阅读
- python - Python使用持续时间匹配加入许多数据帧
- mongodb - 在 MongoDB 中使用 GROUP by LEFT JOIN
- wordpress - get_the_post_thumbnail 在添加类时添加垃圾
- macos - SwiftUI:如何在 MacOS 中用另一个视图替换视图
- java - 如何从 Java 中读取 proto3 自定义选项
- java - 宾果游戏 Java
- android - Xamarin 应用无法识别任何蓝牙设备 (Plugin.BluetoothLE)
- node.js - 在没有密码提示的情况下运行 sudo 命令
- java - 移动 3 个对象但保持对齐的公共方法
- android - 屏幕关闭时如何保持相机预览打开?