View Full Version : delete value
oleg_v
02-25-2010, 02:50 AM
Hello
i need some help with a macro that will search for a number1 in column "a" and writes the number2 in the same row in column "b"
the numbers 1&2 shuld be promted with input box
thanks
krishhi
02-25-2010, 04:26 AM
Hello
i need some help with a macro that will search for a number1 in column "a" and writes the number2 in the same row in column "b"
the numbers 1&2 shuld be promted with input box
thanks
Try this
Sub TEST()
Dim i, lr As Integer
Dim x, n As Integer
lr = ActiveSheet.UsedRange.Rows.Count
x = InputBox("Enter the value to find")
For i = 1 To lr
If UCase(x) = Range("A" & i).Value Then
Y = InputBox("Enter value to input")
Range("B" & i).Value = UCase(Y)
End If
Next
End Sub
:thumb
krishhi
02-25-2010, 04:29 AM
I think Your Post Title doesn't mean to your post.
krishi,
I think you mean:
Option Explicit
Sub TEST()
Dim i As Long 'Ranges and Row use Longs
Dim x As Long 'OP only looking for numbers
Dim y As Long 'If Type not declared, Type = Variant
Dim lr As Long 'Count returns a Long
lr = ActiveSheet.UsedRange.Rows.Count
x = InputBox("Enter number to find")
'Next will find every instance of x
For i = 1 To lr
If Range("A" & i).Value = x Then 'x is found
Y = InputBox("Enter number to input")
Range("B" & i).Value = y
End If
Next 'Find next instance of x
End Sub
krishhi
02-25-2010, 07:03 AM
@Oleg
small edit
If UCase(x) = UCase(Range("A" & i).Value) Then
@saMt
Is your Code worked?
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.