ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Value extraction problem (https://www.excelbanter.com/excel-programming/371184-value-extraction-problem.html)

J.W. Aldridge

Value extraction problem
 
I got the code below to work. However I am having problems changing
the
code to fit my cell criteria/range. I've played around with this one
for quite some time, and the places that I would normally make changes
to the range doesn't seem to work.


Instead of A:A to B:B. .....I need this code to reflect B12:B3000 to
L12:L3000

Thanx


Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRow As Long
If Target.Cells.Count 1 Then Exit Sub
If Target.Column < 1 Then Exit Sub


Application.EnableEvents = False
If Application.CountIf(Range("B:B"), Target.Value) = 0 Then
Range("B65536").End(xlUp)(2).Value = Target.Value
End If


For myRow = Range("B65536").End(xlUp).Row To 2 Step -1
If IsError(Application.Match(Cells(myRow, 2).Value, Range("A:A"),
False)) Then
Cells(myRow, 2).ClearContents
End If


Next myRow


Application.EnableEvents = True


End Sub



All times are GMT +1. The time now is 02:06 AM.

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