简体   繁体   English

在Excel中查找包含单元格的特定字符串的位置

[英]Finding position of a particular string containing cell in Excel

I am searching for a string using below code 我正在使用以下代码搜索字符串

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.

I need to know position for a particular string in sheet1 Then autofill data which is beneath that string position in sheet2 我需要知道sheet1中特定字符串的位置,然后自动填充sheet2中该字符串位置下方的数据

One way: 单程:

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

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用VBA在Excel中查找包含搜索字符串的单元格位置 - Find cell position containing search string in Excel using VBA 通过在EXCEL列中查找文本来转到特定的单元格 - Go to particular cell by finding text in the column EXCEL 从包含特定单词后的字符串的单元格中提取值 - Extracting value from a cell containing string after particular word 在excel中必须在单元格中搜索特定的字符串并将样式应用于该特定的字符串 - In excel have to search for specific string in cell and apply style to that particular string 即使在Excel VBA中即使中间有空白单元格,也要查找最后一个非空单元格中包含的值 - Finding the value containing in the last non empty cell even if there is blank cell in the middle in excel vba 在Excel中选择特定单元格 - Selecting a particular cell in Excel Excel-根据包含范围字符串的单元格绘制图表(间接?) - Excel - draw a chart based on a cell containing the string of a range (indirect?) 将 Excel 单元格设置为等于包含日期的字符串而不带前导撇号 - Set Excel cell equal to string containing date without leading apostrophe Excel:VBA宏从包含字符串的单元格中提取关键字 - Excel : VBA Macro to extract keyword from cell containing string 从包含excel文本字符串的单元格中提取日期 - extract a date from a cell containing text string in excel
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM