ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help needed (https://www.excelbanter.com/excel-programming/357938-help-needed.html)

[email protected]

Help needed
 
Hi,

I would like to know how to code macro to select range of columns and
compare the value of each cell.Here is an example of the file. I want
to check TCIT column and if the value is "Y" copy the row to a seperate
Sheet.

1 4 TCIT Y/N 3 4 5 6
Maint or Proj
4 r N N/A N ??? Test
2 ??? Y P N t Test
4 r N N/A N ??? Test


Thanks for help

Vedula


Martin

Help needed
 
Sub CopyRow()
Dim myCell As Range
Dim mySheet1 As Worksheet
Dim mySheet2 As Worksheet
Set mySheet1 = Worksheets(InputBox("Enter name of input sheet"))
Set mySheet2 = Worksheets(InputBox("Enter name of output sheet"))
mySheet1.Activate
Range("A1").CurrentRegion.Select
Selection.Offset(0, 2).Resize(, 1).Select
For Each myCell In Selection
If UCase(myCell.Value) = "Y" Then
myCell.EntireRow.Copy
mySheet2.Activate
Range("A1").CurrentRegion.Select
Selection.Offset(Selection.Rows.Count).Resize(1, 1).Select
ActiveSheet.Paste
End If
Next myCell
End Sub

Good luck!

" wrote:

Hi,

I would like to know how to code macro to select range of columns and
compare the value of each cell.Here is an example of the file. I want
to check TCIT column and if the value is "Y" copy the row to a seperate
Sheet.

1 4 TCIT Y/N 3 4 5 6
Maint or Proj
4 r N N/A N ??? Test
2 ??? Y P N t Test
4 r N N/A N ??? Test


Thanks for help

Vedula




All times are GMT +1. The time now is 01:04 PM.

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