Gerardo Nuno
New Member
Hello everyone!
Wondering if someone can help me to use the InputBox correctly.
the below code, works ok, when entering data in cell G6.
But I want to run the code using and InputBox instead of data entry on a cell.
Any help will be highly appreciated!
Thanks in advanced,
GN
San Diego, CA (USA)
Wondering if someone can help me to use the InputBox correctly.
the below code, works ok, when entering data in cell G6.
But I want to run the code using and InputBox instead of data entry on a cell.
Any help will be highly appreciated!
Thanks in advanced,
GN
San Diego, CA (USA)
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ScanValue As String
Dim LoopValue As Integer
Dim NotMatch As Boolean
Dim LDate As String
LDate = Date
NotMatch = False
LoopValue = 7
'Run the Macro when selection cell "g6" content changed
If Target.Row = 6 And Target.Column = 7 Then
Range("g6").Select
'If target value not empty, find the column "C"
If Target.FormulaR1C1 <> "" Then
ScanValue = Target.FormulaR1C1
'Seek Column C until any cell value is empety
Do Until Sheets("RMA_Receiving").Range("c" & LoopValue).FormulaR1C1 = ""
'if "g6" value equal to current Cx cell value, update Ix cell value as scanvalue
If ScanValue = Sheets("RMA_Receiving").Range("c" & LoopValue).FormulaR1C1 Then
Sheets("RMA_Receiving").Range("g" & LoopValue).FormulaR1C1 = LDate
NotMatch = True
End If
LoopValue = LoopValue + 1
Loop
End If
If NotMatch = False Then
MsgBox ("This Serial Number is incorrect or not exist, please check again!")
Range("g6").Select
End If
End If
End Sub