ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   simple conditional find, copy and paste (https://www.excelbanter.com/excel-programming/283621-simple-conditional-find-copy-paste.html)

lothario[_56_]

simple conditional find, copy and paste
 

Hi,

I have:

Workbook called "wb1".
= It contains sheets "Asheet" and "Bsheet".
= "Asheet" contains 900 rows of data.
= "Asheet" contains the columns "1col", "2col", "3col", "4col"
"5col", etc ...

I would like to:

* Have a button in "Bsheet" called "Get Data from Asheet".
* First the user enters some search criteria text in cell c5 i
"Bsheet".
* Then he clicks on the "Get Data from Asheet" button.
* The VBA code attached to the "Get Data from Asheet" button woul
then find all the rows in "Asheet" where "3col" contains the text tha
is specified in cell c5 in "Bsheet".
* All the rows in "Asheet" that contain this text in "3col" should b
copied to "Bsheet" beginning at cell d9.
* Note: in the case of column "3col" the text should just contain th
criteria text. There is no need for an exact match or cas
sensitivity.

Can you please give me the VBA code for this "Get Data from Asheet
button?

Thanks,
Luthe

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


lothario[_59_]

simple conditional find, copy and paste
 

Hi,

I still need help with this VBA script.
Can you please help?

Thanks,
Luther


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements

Bill Manville

simple conditional find, copy and paste
 
Lothario wrote:
I still need help with this VBA script.
Can you please help?

Something like this - but you may need to adjust the bit about the
criteria - not sure if I have understood your requirement


With ASheet.Range("A1").CurrentRegion
.AutoFilter
.AutoFilter 3, BSheet.Range("C5").Value
.Offset(1).SpecialCells(xlVisible).Copy
BSheet.Range("D9").PasteSpecial xlValues
Application.CutCopyMode = False
.AutoFilter
End With

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup



All times are GMT +1. The time now is 08:59 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com