Search functionality,copy and paste
Closed
pinki
-
Apr 27, 2015 at 05:57 AM
pinkipanchal Posts 2 Registration date Monday April 27, 2015 Status Member Last seen April 27, 2015 - Apr 27, 2015 at 07:08 AM
pinkipanchal Posts 2 Registration date Monday April 27, 2015 Status Member Last seen April 27, 2015 - Apr 27, 2015 at 07:08 AM
Related:
- Search functionality,copy and paste
- Yahoo search history - Guide
- Safe search settings - Guide
- Google.us search - Guide
- Duckduckgo safe search - Guide
- How to search for words on a page - Guide
1 response
pinkipanchal
Posts
2
Registration date
Monday April 27, 2015
Status
Member
Last seen
April 27, 2015
Apr 27, 2015 at 07:08 AM
Apr 27, 2015 at 07:08 AM
Public strData2 As String
Public strSearchSheet As String
Public strRange2 As String
Sub NewSearch()
'User Prompt box to enter IO driver type
strData2 = InputBox(Prompt:="Enter the keyword", _
Title:="ENTER TYPE", Default:="Type here")
'strSearchSheet = InputBox(Prompt:="Enter Sheet name to search. (IE AI).", _
Title:="ENTER TYPE", Default:="Type here")
'User Prompt box to enter Column to search
'strRange2 = InputBox(Prompt:="Enter Column you wish to search. (IE E).", _
'Title:="ENTER TYPE", Default:="Type here")
Dim LSearchRow As Integer
Dim LCopyToRow As Integer
'On Error GoTo Err_Execute
'Start search in row 3
Worksheets("Sheet6").Activate
LSearchRow = 3
'Start copying data to row 2 in Sheet2 (row counter variable)
LCopyToRow = 2
While Len(Range("A" & CStr(LSearchRow)).Value) > 0
'If value in column = "TEXT", copy entire row to Sheet2
If Range(strRange2 & CStr(LSearchRow)).Value = strData2 Then
'Select row in Sheet1 to copy
Rows(CStr(LSearchRow) & ":" & CStr(LSearchRow)).Select
Selection.Copy
'Paste row into Sheet2 in next row
Sheets("Test").Select
Rows(CStr(LCopyToRow) & ":" & CStr(LCopyToRow)).Select
ActiveSheet.Paste
'Move counter to next row
LCopyToRow = LCopyToRow + 1
'Go back to Sheet1 to continue searching
Sheets("AO").Select
End If
LSearchRow = LSearchRow + 1
Wend
'Position on cell A3
Application.CutCopyMode = False
Range("A3").Select
MsgBox "All matching data has been copied."
Exit Sub
Err_Execute:
MsgBox "An error occurred."
End Sub
Public strSearchSheet As String
Public strRange2 As String
Sub NewSearch()
'User Prompt box to enter IO driver type
strData2 = InputBox(Prompt:="Enter the keyword", _
Title:="ENTER TYPE", Default:="Type here")
'strSearchSheet = InputBox(Prompt:="Enter Sheet name to search. (IE AI).", _
Title:="ENTER TYPE", Default:="Type here")
'User Prompt box to enter Column to search
'strRange2 = InputBox(Prompt:="Enter Column you wish to search. (IE E).", _
'Title:="ENTER TYPE", Default:="Type here")
Dim LSearchRow As Integer
Dim LCopyToRow As Integer
'On Error GoTo Err_Execute
'Start search in row 3
Worksheets("Sheet6").Activate
LSearchRow = 3
'Start copying data to row 2 in Sheet2 (row counter variable)
LCopyToRow = 2
While Len(Range("A" & CStr(LSearchRow)).Value) > 0
'If value in column = "TEXT", copy entire row to Sheet2
If Range(strRange2 & CStr(LSearchRow)).Value = strData2 Then
'Select row in Sheet1 to copy
Rows(CStr(LSearchRow) & ":" & CStr(LSearchRow)).Select
Selection.Copy
'Paste row into Sheet2 in next row
Sheets("Test").Select
Rows(CStr(LCopyToRow) & ":" & CStr(LCopyToRow)).Select
ActiveSheet.Paste
'Move counter to next row
LCopyToRow = LCopyToRow + 1
'Go back to Sheet1 to continue searching
Sheets("AO").Select
End If
LSearchRow = LSearchRow + 1
Wend
'Position on cell A3
Application.CutCopyMode = False
Range("A3").Select
MsgBox "All matching data has been copied."
Exit Sub
Err_Execute:
MsgBox "An error occurred."
End Sub
Apr 27, 2015 at 07:08 AM