ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Please help - Find & copy Macro (https://www.excelbanter.com/excel-worksheet-functions/230054-please-help-find-copy-macro.html)

Damil4real

Please help - Find & copy Macro
 
Please help -

Macro to find "E4" value in column A. If found, copy found value from
the A column and paste in cell A5.

All info are in sheet named is List.

Thanks!

JCS

Please help - Find & copy Macro
 
Hi,

Try the following code: I'm assuming you know hw to inser this code into a
VBA module. This also assumes that there are no blanks in column A.

Sub FindValue()
Dim CellValue As Variant
Dim i As Variant

CellValue = Range("e4").Value
Application.ScreenUpdating = False
Range("e5").ClearContents
Range("a1").Select

For i = 1 To Range("a1").End(xlDown).Row

If ActiveCell().Value = CellValue Then
Selection.Copy
Range("E5").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Else
ActiveCell.Offset(1, 0).Select

End If

Next i
Application.ScreenUpdating = True
Range("a1").Select
End Sub

John

"Damil4real" wrote:

Please help -

Macro to find "E4" value in column A. If found, copy found value from
the A column and paste in cell A5.

All info are in sheet named is List.

Thanks!



All times are GMT +1. The time now is 07:10 PM.

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