Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
How to make a Microsoft Office Excel 2007 Function?
I need to create a function for if column d equals certain name the whole row will be copied to sheet 2. When doing this I want to keep original in sheet one and be able to edit copy in sheet two without change to original.
2 Answers
- AmitLv 61 decade agoFavorite Answer
Hi..Kel,
if you want to make your own function then you have to write a macro (but it a sub not function. that meance it will persorm some task and not return any value)
copy below code in VBA editor
Sub Check_and_copy()
For i = 1 To Sheet1.Cells.SpecialCells(xlCellTypeLastCell).Row
If Sheet1.Cells(i, 1) = "Some Name" Then
ThisWorkbook.Activate
Rows(i & ":" & i).Select
Selection.Copy
Windows("Workbook1").Activate
ActiveCell.SpecialCells(xlCellTypeLastCell).Select
ActiveCell.Offset(1, ActiveCell.Column * -1 + 1).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End If
Next
MsgBox "Done"
Range("A1").Select
End Sub
and run
but I suggest to use VLOOKUP Function to achieve your goal. To learn more about Vlookup visit: