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

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

iliace

Well-known Member
Joined
Jan 15, 2008
Messages
3,546
Office Version
  1. 365
  2. 2016
  3. 2010
Platform
  1. Windows
You can use AutoFilter to isolate all rows in which a particular column = x.
 
Upvote 0

MNpoker

Board Regular
Joined
Dec 15, 2003
Messages
154
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,191,718
Messages
5,988,267
Members
440,146
Latest member
rgomes8

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
Top