Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy rows to multiple sheets pvkutty Excel Discussion (Misc queries) 1 February 24th 10 07:25 AM
COPY MULTIPLE ROWS INSERTED BELOW EACH Justaddcat Excel Discussion (Misc queries) 5 December 19th 08 04:48 AM
large database with multiple rows Steve Excel Worksheet Functions 2 January 14th 08 02:04 PM
How to make reference to database and if true copy from database? V!p3r Excel Discussion (Misc queries) 4 February 5th 07 02:19 PM
Copy Multiple Rows into One Cell fijiflyer Excel Discussion (Misc queries) 3 December 13th 06 05:49 PM


All times are GMT +1. The time now is 02:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"