Good Morning, all,
Hoping to get some help with a macro I'm trying to create. In essence, I'm trying to write VBA for excel to look at a value in a cell, take an inputted value from the user, and validate that the inputted value matches the value in the cell it's looking at. If the value does match, excel would then move to the next cell in the column, and perform the same function again. I'm also trying to do this while providing text and input boxes to the user.
Ideal state, it would look like this:
Macro prompts user with infobox for value in A2
C2= 40
User Input (value placed into D2) = 40
Value for C2 and D2 match
Excel moves to A3
C3= 40
User Input (value placed into D3)= 40
Value for C3 and D3 match
Excel moves to A4
C4= 40
User Input (value placed into D4) = 30
Value for C4 and D4 do not match
Excel requires user to input D4 again. If D4 is still incorrect, Excel moves to A5
Macro stops when it arrives at blank cell in column A
Here is some of the code I've been working on to accomplish this- where I am stuck is how to get excel to move to the next cell in column A, and how to make it check again when a non-matching value is entered before moving to the next cell in column A.
Sub Entry()
'
Dim myValue As Variant
Range("A2").Select
MsgBox "Please move to bin " & ActiveCell.Value
myValue = InputBox("Please enter the total quantity in " & ActiveCell.Value)
Range("D2").Value = myValue
If myValue = Range("C2").Value Then
ActiveCell.Offset(1, 0).Select
End If
'
End Sub
Any help would be greatly appreciated!
Hoping to get some help with a macro I'm trying to create. In essence, I'm trying to write VBA for excel to look at a value in a cell, take an inputted value from the user, and validate that the inputted value matches the value in the cell it's looking at. If the value does match, excel would then move to the next cell in the column, and perform the same function again. I'm also trying to do this while providing text and input boxes to the user.
Ideal state, it would look like this:
Macro prompts user with infobox for value in A2
C2= 40
User Input (value placed into D2) = 40
Value for C2 and D2 match
Excel moves to A3
C3= 40
User Input (value placed into D3)= 40
Value for C3 and D3 match
Excel moves to A4
C4= 40
User Input (value placed into D4) = 30
Value for C4 and D4 do not match
Excel requires user to input D4 again. If D4 is still incorrect, Excel moves to A5
Macro stops when it arrives at blank cell in column A
Here is some of the code I've been working on to accomplish this- where I am stuck is how to get excel to move to the next cell in column A, and how to make it check again when a non-matching value is entered before moving to the next cell in column A.
Sub Entry()
'
Dim myValue As Variant
Range("A2").Select
MsgBox "Please move to bin " & ActiveCell.Value
myValue = InputBox("Please enter the total quantity in " & ActiveCell.Value)
Range("D2").Value = myValue
If myValue = Range("C2").Value Then
ActiveCell.Offset(1, 0).Select
End If
'
End Sub
Any help would be greatly appreciated!