Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy multiple rows from a database
I'd like to copy multiple rows based on the criteria entered into a text box,
using wildcard search capability and then be pasted onto another sheet. Eg, copy all rows where "test*" is in column A. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
copy multiple rows from a database
Hi
Try this one that use AutoFilter You can use a inputbox if you want also Sub Copy_with_Autofilter() Dim FilterValue As String Dim rng As Range Dim rng2 As Range Set rng = Range("A:A") FilterValue = "test*" rng.AutoFilter Field:=1, Criteria1:=FilterValue With ActiveSheet.AutoFilter.Range On Error Resume Next Set rng2 = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _ .SpecialCells(xlCellTypeVisible) On Error GoTo 0 If Not rng2 Is Nothing Then rng2.EntireRow.Copy Sheets("Sheet2").Range("A1") End If End With ActiveSheet.AutoFilterMode = False End Sub -- Regards Ron de Bruin http://www.rondebruin.nl "bradasley" wrote in message ... I'd like to copy multiple rows based on the criteria entered into a text box, using wildcard search capability and then be pasted onto another sheet. Eg, copy all rows where "test*" is in column A. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
copy rows to multiple sheets | Excel Discussion (Misc queries) | |||
COPY MULTIPLE ROWS INSERTED BELOW EACH | Excel Discussion (Misc queries) | |||
large database with multiple rows | Excel Worksheet Functions | |||
How to make reference to database and if true copy from database? | Excel Discussion (Misc queries) | |||
Copy Multiple Rows into One Cell | Excel Discussion (Misc queries) |