I am new to VBA and excel macro, I want to create a macro which will search for text in Column and if found will copy corresponding value from column B to another workbook.
Example: Macro will search for fixed "TextA3" from column A and if found will copy value from B3 (which is TextB3 in below example)and will paste to another workbook.
TextA1 TextB1
TextA2 TextB2
TextA3 TextB3
TextA4 TextB4
TextA5 TextB5
TextA6 TextB6
TextA7 TextB7
Tried searching this website but unable to figure out how to copy adjacent cell.
I am working with below code:
Sub Luxation2()
Dim K As Long, r As Range, v As Variant
K = 1
Dim w1 As Worksheet, w2 As Worksheet
Set w1 = Sheets("raw data")
Set w2 = Sheets("data manipulation")
w1.Activate
For Each r In Intersect(Range("A:A"), ActiveSheet.UsedRange)
v = r.Value
If InStr(v, "Ticket No. ") > 0 Then
r.Copy w2.Cells(K, 1)
K = K + 1
End If
Next r
End Sub
Many thanks! in advance.