在Excel中查找包含单元格的特定字符串的位置
我正在使用下面的代码搜索字符串在Excel中查找包含单元格的特定字符串的位置,excel,vba,Excel,Vba,我正在使用下面的代码搜索字符串 For x = 2 To lastrow If Sheets("sheet1").Cells(x, 3) = TFMODE Then ....... 'TFMODE is the string discussed 'This particular string "TFMODE" is randomly recurring throughout 'sheet in column 3. 我需要知道特定字符串在表1中的位置 然
For x = 2 To lastrow
If Sheets("sheet1").Cells(x, 3) = TFMODE Then
.......
'TFMODE is the string discussed
'This particular string "TFMODE" is randomly recurring throughout
'sheet in column 3.
我需要知道特定字符串在表1中的位置
然后,单向自动填充表2中该字符串位置下方的数据:
Sub qwerty()
lastrow = 10
For x = 2 To lastrow
If InStr(Sheets("Sheet1").Cells(x, 3), "TFMODE") > 0 Then
MsgBox Sheets("Sheet1").Cells(x, 3).Address(0, 0)
End If
Next x
End Sub
请尝试此问题中的答案来查找您的查找问题——谢谢@Gary的学生找到职位后,需要在表2中填写相应的必填值。例:1。我们已找到位置C7,现在将C8和B8的数据填入表2。如果位置为C9,则从C10和B10填充数据。。。。。直到循环结束,直到最后一行