0

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

Alex K.
  • 171,639
  • 30
  • 264
  • 288
  • Try the answers in this question http://stackoverflow.com/questions/12642164/check-if-value-exists-in-column-in-vba/12643082#12643082 for your find question -- – scott Jun 15 '15 at 14:55

1 Answers1

0

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

enter image description here

Gary's Student
  • 95,722
  • 10
  • 59
  • 99
  • After finding position, need to fill corresponding required values in sheet2. Eg: 1. we have found position as C7, now fill data of C8 and B8 to sheet2 2. If position is C9, fill data from C10 and B10..... untill loop ends till lastrow – Abhas Tiwari Jun 16 '15 at 06:31