IF Condition: Filter and Paste Contents to Another Sheet

Flani

New Member
Joined
Jul 11, 2012
Messages
17
What I need is to check if a particular cell has value, if it contains value, we go to Imagine sheet and filter B12 for the account or value of cell e39 of macro. A12:m12(headers). everything works well from there now i need to copy the rows (a:m) after filtering for the account and pasting it as values in sheet1
select_all_icon.jpg


<code style="margin: 0px; padding: 0px; font-style: inherit;">Sub Try()Set rg = Sheets("Macro").Range("E39")If rg.Value <> "" Then Sheets("Imagine").Range("A12:M12").AutoFilter Field:=2, Criteria1:=rg.ValueSelection.SpecialCells(xlCellTypeVisible).Select'Copy the cellsSelection.CopySheets(Sheet1).Range(a1).SelectSelection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Application.CutCopyMode = FalseCells.SelectSelection.Columns.AutoFitEnd Sub</code></pre>
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,207,258
Messages
6,077,345
Members
446,279
Latest member
hoangquan2310

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