Copy Macro

wazzulu1

Board Regular
Joined
Oct 4, 2006
Messages
164
Hi;

I am trying to create a macro that will copy rows of data from one tab in a workbook, to another, based on a checkbox value of true in column AR.

If the box is checked, meaning true:

if ar = true

then

copy row from customer file to flash report

after row 10

columns A:AS

Appreciate any insight, as I seek to move from being a newbie to a moderate with Excel.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,454
Hi wazzulu1,
Are you wanting to copy all rows that have 'True' in column AR?
Do you want to copy the entire row(s), or just columns A:AS?
Do you want these pasted in the 'flash report' sheet starting in column A?
What is the actual name of the 'flash report' sheet?
(And you want the pasted rows to start in row 11, right?)
 

wazzulu1

Board Regular
Joined
Oct 4, 2006
Messages
164
Hi Halface!

Thanks for the inquiry, my answers are next to each question:

Hi wazzulu1,
Are you wanting to copy all rows that have 'True' in column AR? (YES)
Do you want to copy the entire row(s), or just columns A:AS? (Columns A:AS
Do you want these pasted in the 'flash report' sheet starting in column A?(YES)
What is the actual name of the 'flash report' sheet? (FLASH REPORT)
(And you want the pasted rows to start in row 11, right?) (YES)
_________________
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,454
You're most welcome.
Try this and see if it's what you're looking for.
(Meant to be run with the sheet containing 'TRUE' in column AR as the active sheet, and
assumes you do in fact have a sheet named 'FLASH REPORT')
Code:
Sub Demo()
Dim LstRw As Long, DestRw As Long
LstRw = Cells(Rows.Count, "AR").End(xlUp).Row
With Sheets("FLASH REPORT")
  If .Range("A11") = "" Then
    DestRw = 11
  Else
    DestRw = .Cells(Rows.Count, "A").End(xlUp)(2).Row
  End If
End With
ActiveSheet.AutoFilterMode = False
On Error GoTo Quit

Columns("AR:AR").AutoFilter Field:=1, Criteria1:="TRUE"
Range("A2:AS" & LstRw).SpecialCells(xlCellTypeVisible).Copy _
  Sheets("FLASH REPORT").Cells(DestRw, "A")
  
Quit:
ActiveSheet.AutoFilterMode = False
End Sub
 

wazzulu1

Board Regular
Joined
Oct 4, 2006
Messages
164
This works perfect!


I'm in the process of ordering the Slide into VBA CD, but I really do need help with stuff like this in the interim.


Thank you so much!
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,454
You're welcome. Glade it helped.

I'm not familiar with slide into VBA. If you're getting it from the Online store here I'm
sure it'll be worth having.
 

Forum statistics

Threads
1,136,430
Messages
5,675,803
Members
419,586
Latest member
RoteichA

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