Scratching my head for hours. VBA to Copy Paste Range on Another Sheet based on criteria

marcelita03

New Member
Joined
Jan 15, 2013
Messages
38
I thought it was simply enough I could write the code... but I can't make it work. I am going nuts. I'm losing my mind. It's too simple why I can't make it work? I tried with copy/paste code...with AutoFilter code.... nothing works

I would appreciate if someone has some code handy that can do this simple process:

Scenario:

1. I have data on a range of cells (from A:H from row 2 to the last row with data) on a Sheet named "Data"

This is what I want to do:

3. IF the value on column "L" has the word "TRUE" then.....
2. Copy all the rows that meet that condition in "Data" and paste the range (A:H) to the LAST ROW of Column A another sheet name "CRM"

Please help. Please Thank you Thank you
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Code:
Sub copystuff()
Dim sh1 As Worksheet, sh2 As Worksheet, lr As Long
Set sh1 = Sheets("Data")
Set sh2 = Sheets("CRM")
lr = sh1.Cells.Find("*", , xlFormulas, xlPart, xlByRows, xlPrevious).Row
sh1.Range("A1:L" & lr).AutoFilter 12, "TRUE"
sh1.Range("A2:H" & lr).SpecialCells(xlCellTypeVisible).Copy sh2.Cells(Rows.Count, 1).End(xlUp)(2)
sh1.AutoFilterMode = False
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,119
Messages
6,128,947
Members
449,480
Latest member
yesitisasport

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