copy and paste based on criteria

ezonemy

New Member
Joined
Dec 7, 2014
Messages
19
hi i have a workbook which contains 2 sheet.

Sheet 1= this is master sheet
Sheet 2= contains list of item(row 9 till 155), each row is different item, staff required to key in amount for that item at column F. Column I contains "defined name" for each item (e.g A9 is item named Admin, F9 is where amount is keyed in and I9 named as item_1).
Require vba code to perform the below;

a) In sheet 2, hide rows from A9 till A155 based on value in column F. (e.g. if F10 is empty, the whole row need to be hidden)
b) Copy all the UNHIDDEN rows from A9 till A155, including the formats and the defined names in column I
c) In sheet 1, paste the copied data at row 168 onwards. If copied data is more than 1 row, need to insert row after row 168 before pasting. Before paste, need to delete any existing info. (there are calculation at row 170 onwards - cannot delete this rows)


Another VBA code to unhide all the hidden rows in sheet 2.

The columns in sheet 1 & sheet 2 are same (column A till M).

Thank you.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Use record macro and do it manually. To modify the existing info delete you'll have to find whatever row it needs to be, probably using Cells.Find(....
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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