Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Excel中查找包含单元格的特定字符串的位置_Excel_Vba - Fatal编程技术网

在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填充数据。。。。。直到循环结束,直到最后一行