amittheexcel
Board Regular
- Joined
- Dec 17, 2013
- Messages
- 50
Hi There,
I have below macro which can be use to select rows if one value available in cell. But i want to remodify this code to select the data more than one value.
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">Sub Test()
ForEach Cell In Sheets(1).Range("J:J")
If Cell.Value ="131125"Then
matchRow = Cell.Row
Rows(matchRow &":"& matchRow).Select
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Rows(matchRow).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
EndIf
Next
EndSub
ex - I need to select row if cell having 131125 or 131126 or 131127.
please help</code>
I have below macro which can be use to select rows if one value available in cell. But i want to remodify this code to select the data more than one value.
<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; white-space: inherit;">Sub Test()
ForEach Cell In Sheets(1).Range("J:J")
If Cell.Value ="131125"Then
matchRow = Cell.Row
Rows(matchRow &":"& matchRow).Select
Selection.Copy
Sheets("Sheet2").Select
ActiveSheet.Rows(matchRow).Select
ActiveSheet.Paste
Sheets("Sheet1").Select
EndIf
Next
EndSub
ex - I need to select row if cell having 131125 or 131126 or 131127.
please help</code>
Last edited by a moderator: