sum if macro VBA

abazdi

New Member
Joined
Jun 11, 2008
Messages
1
I am looking for a macro to copy certain columns from one sheet to another if the code in a column = x. So its if column code = x in sheet 1, copy columns 1,2,3,4 to the other sheet because i am trying to only copy/paste data related to column code x and not if code is somethin else.
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
You can use AutoFilter to isolate all rows in which a particular column = x.
 
Upvote 0
I am looking for a macro to copy certain columns from one sheet to another if the code in a column = x. So its if column code = x in sheet 1, copy columns 1,2,3,4 to the other sheet because i am trying to only copy/paste data related to column code x and not if code is somethin else.

Do While Column 1 is not blank
z = z + 1
If Range("A1").offset(z,0) = 'x' Then (Other Sheet) Range = what is on the other sheet **
Loop

** There are a variety of ways to do this.

Next question (I like macros but) can you just put a formula in the other sheet like =If(sheet1!A1 = "x", Sheet1!B1, "")
 
Upvote 0

Forum statistics

Threads
1,213,485
Messages
6,113,931
Members
448,533
Latest member
thietbibeboiwasaco

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