Stranger8421
New Member
- Joined
- Jun 30, 2022
- Messages
- 23
- Office Version
- 365
Hello Guys,
Need help from you guys.
Below This sheet: When we clicked on the Validate Button. It should check for the Order Id (B column), Only Normal (C column) or Only Premium (D column) should be entered. If Both C and D column is entered, The message should be shown "Please enter either One of the columns". Note : for Order Id -1233. Normal and Premium should not enter till range C3 : D4 , only C2 OR D2 should be entered. If entered range is C3:D4 message should be shown "Please enter Normal or premium only in Order Line"
and one boolean should be there. and also one boolean should be there. All entered data is correct means true else false.
Final Correct user input should be given in below sheet: Here see For one Order - only entered is Normal or premium.
And I tried till the Range selection for the Order.
<VBA Code>
Private Sub validate_Click()
Dim i As Long, j As Long, lastrow As Long, rng As Long
lastrow = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lastrow
If Cells(i, "B") <> "" Then
rng = Cells(i, "B").End(xlDown).Row - 1
If Cells(i + 1, "B") <> "" Then rng = i
'code should enter here
End If
Next i
End Sub
</VBA COde>
Thanks for reading my thread.
Regards,
Joe
Need help from you guys.
Below This sheet: When we clicked on the Validate Button. It should check for the Order Id (B column), Only Normal (C column) or Only Premium (D column) should be entered. If Both C and D column is entered, The message should be shown "Please enter either One of the columns". Note : for Order Id -1233. Normal and Premium should not enter till range C3 : D4 , only C2 OR D2 should be entered. If entered range is C3:D4 message should be shown "Please enter Normal or premium only in Order Line"
and one boolean should be there. and also one boolean should be there. All entered data is correct means true else false.
Name | Order Id | Normal | Premium | add-on |
ABC | 1233 | 12 | ||
32 | ||||
23 | ||||
bbc | 3223 | 45 | ||
32 | ||||
ccc | 3333 | 23 |
Final Correct user input should be given in below sheet: Here see For one Order - only entered is Normal or premium.
Name | Order Id | Normal | Premium | add-on |
ABC | 1233 | 23 | 12 | |
32 | ||||
23 | ||||
bbc | 3223 | 22 | 45 | |
32 | ||||
ccc | 3333 | 12 | 23 |
And I tried till the Range selection for the Order.
<VBA Code>
Private Sub validate_Click()
Dim i As Long, j As Long, lastrow As Long, rng As Long
lastrow = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To lastrow
If Cells(i, "B") <> "" Then
rng = Cells(i, "B").End(xlDown).Row - 1
If Cells(i + 1, "B") <> "" Then rng = i
'code should enter here
End If
Next i
End Sub
</VBA COde>
Thanks for reading my thread.
Regards,
Joe