ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy and paste row based on cell content (https://www.excelbanter.com/excel-programming/365958-copy-paste-row-based-cell-content.html)

BDan

Copy and paste row based on cell content
 
I'm having trouble writing a macro that will copy a row of a table and paste
it into another sheet based on if the contents of a single cell in the row
contain a certain word.
Thanks,
BDan

Die_Another_Day

Copy and paste row based on cell content
 
Sub CopyRow()
Dim SingleCell as Range
Set SingleCell = Range("A1")
If InStr(1,SingleCell.Value,"certain word") 0 Then
SingleCell.EntireRow.Copy
Sheets(2).Activate
Cells(1,1).PasteSpecial xlPasteAll
End Sub

HTH

Die_Another_Day

BDan wrote:
I'm having trouble writing a macro that will copy a row of a table and paste
it into another sheet based on if the contents of a single cell in the row
contain a certain word.
Thanks,
BDan




All times are GMT +1. The time now is 08:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com