Macro help

excellrookie

New Member
Joined
Mar 23, 2011
Messages
17
How would I code a macro that scans a specific column for a key phrase, once the macro finds the phrase it will display the entire row of information.

For example:
the macro would search the entire column B and find any cells that have the value "EXCEL FORUM," lets say it found that phrase in row 34, then it copies the entire row 34 and paste the row in the cell that the macro was run in.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
How would I code a macro that scans a specific column for a key phrase, once the macro finds the phrase it will display the entire row of information.

For example:
the macro would search the entire column B and find any cells that have the value "EXCEL FORUM," lets say it found that phrase in row 34, then it copies the entire row 34 and paste the row in the cell that the macro was run in.

Maybe this could give you some ideas?

Code:
Sub excellrookie()
Dim lr As Long

lr = Cells(Rows.Count, 1).End(xlUp).Row

x = InputBox("Please Enter the Destination Range")

Columns("B:B").AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="EXCEL FORUM"
Range("B2:B" & lr).EntireRow.SpecialCells(xlCellTypeVisible).Copy Range(x)
Columns("B:B").AutoFilter

End With
End Sub
 
Upvote 0
Maybe this could give you some ideas?

Code:
Sub excellrookie()
Dim lr As Long

lr = Cells(Rows.Count, 1).End(xlUp).Row

x = InputBox("Please Enter the Destination Range")

Columns("B:B").AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="EXCEL FORUM"
Range("B2:B" & lr).EntireRow.SpecialCells(xlCellTypeVisible).Copy Range(x)
Columns("B:B").AutoFilter

End With
End Sub

Thank you John. I will check it out in a few :)
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top