我想浏览一张纸上的一张桌子。找到一个后,在其中找到每个带有“是”的单元格。当找到另一个A2等时,将“是”粘贴到A1等。
我试图修改此代码以搜索所有单元,而不仅仅是行A
答案 0 :(得分:0)
以下代码应为您提供先机
The request includes a departure_time parameter.
The request includes a valid API key, or a valid Google Maps Platform Premium Plan client ID and signature.
Traffic conditions are available for the requested route.
The mode parameter is set to driving.
答案 1 :(得分:0)
在@isomericharsh的答案之外,如果要查看的是表格,可以简化范围的定义。只需使用DataBodyRange。
如果表'Table1'在'Sheet1'上并且结果要发布在'Sheet2'上,那么我将执行以下操作:
Sub Search_for_Yes()
Dim YesAmt As Long ' - Amount of yes's found
YesAmt = 0 'to start with
Dim ws1 As Worksheet
Set ws1 = Sheets("Sheet1")
Dim ws2 As Worksheet
Set ws2 = Sheets("Sheet2")
'It's always safer to use specific references rather than ActiveSheet
For Each cell In ws1.ListObjects("Table1").DataBodyRange 'The data in the table excluding headings and totals
If cell.Value = "YES" Then 'might need to add wildcards to this if you want to include cells that contain yes as part of larger text string. Also note that it's case-specific.
ws2.Cells(1 + YesAmt, 1).Value = "Yes" 'so that each time a yes is found it will log it further down
YesAmt = YesAmt + 1
End If
Next
x = MsgBox(YesAmt & " values found and listed", vbOKOnly + vbInformation)
End Sub
有帮助吗?