Help needed

  • Thread starter Thread starter ramgopal.vedula
  • Start date Start date
R

ramgopal.vedula

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
 
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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top