VBA copy entire row based on multiple criteria

GEO81

New Member
Joined
Feb 9, 2022
Messages
12
Office Version
  1. 365
Platform
  1. Windows
Hello!

I'm working on a macro and i need some help.
I need to copy the entire rows from another workbook to my active workbook if a condition is met. The condition is a combination or 3 other conditions conected with OR.

I'm giving an example below.
Lets say i have the below table and my condition is: If Value1 is =<30 OR Value2=<100 or Value3 =<50 THEN copy the entire row to my active workbook/worksheet.
Just to mention that i need the Input Values 30, 100, 50 to have flexibility to amend. So I need an Input Box to prompt the user to enter those 3 conditions.
So should i use a UserForm?

Also i have to ensure that Blank cells will not be considered as cells with Value=0.

Data1Data2Data3Value1Value2Value3
Name1A
1​
20​
150​
Name2B
2​
10​
200​
10​
Name3C
3​
100​
15​
Name4D
4​
100​
50​
Name5E
5​
80​
0​
60​
Name6F
6​
35​
Name7G
7​
40​
Name8H
8​
120​
Name9I
8​
80​

The Result should be the following Table:

Data1Data2Data3Value1Value2Value3
Name1A
1​
20​
150​
Name2B
2​
10​
200​
10​
Name3C
3​
100​
15​
Name4D
4​
100​
50​
Name5E
5​
80​
0​
60​
Name7G
7​
40​

Any help is more than welcome!
Thanks!
 
You're welcome. Thanks for the follow-up. :)
Also hope that you are fully recovered!
 
Upvote 0

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest

Forum statistics

Threads
1,215,425
Messages
6,124,826
Members
449,190
Latest member
rscraig11

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top