I have the excel formula below to pull data from another sheet.
These cells used, C4 and A4, will always remain the same. Different item numbers are being scanned in one after another so the values in the cells will change.
When the word Yes is shown in C4 i would like it to record the item # in A4 into the new sheet. This formula works great for that.
However, after the item # is recorded in the new sheet, i would like it to go down to the next row and copy the formula so it can record the next item # scanned.
Is this VBA possible? thank you!
I think you are trying to get something like
If Worksheets("Sheet7").Range("C4").Value Like "*Yes*" Then ActiveCell.Value = Worksheets("Sheet7").Range("A4").Value Else ActiveCell.Value = "" End If
but don't use
ActiveCell - use a proper reference to the cell in which you want to put the value. (Your question doesn't contain enough information to determine what the location is, which is why I was forced to just refer to it as
Based on comments, it sounds like you want the following
Worksheet_Change event in
Private Sub Worksheet_Change(ByVal Target As Range) If Target.Cells.Count <> 1 Then Exit Sub End If If Intersect(Range("A4"), Target) Is Nothing Then Exit Sub End If If Range("C4").Value Like "*Yes*" Then With Worksheets("Sheet1") .Cells(.Rows.Count, "A").End(xlUp).Offset(1, 0).Value = Target.Value End With End If End Sub