Prompt input box if value is true

TORPIDO

New Member
Joined
Aug 2, 2017
Messages
26
Hi all,

I've done couple of searches but couldn't exactly match what im looking for, appreciate if someone can help me and hope I don't **** anyone :p

im trying to get an input box to be promoted if column "A" value is "Ok" and myValue is then copied in relevant B column

so it looks like:

if A1 = "ok" then prompt inputbox and value entered is copied to B1
 
hi Fluff, sorry for late response...

the offset part is returning error somehow;

below the exact what im using, can you please have a look, highlighted part is what seems to have issue;

I thought it could be due to column being locked, but checked it, it is not

Private Sub Worksheet_Change(ByVal Target As Range)
Me.Unprotect Password:="dxb20"
Target.Locked = True
Me.Protect Password:="dxb20"
If Target.CountLarge > 1 Then Exit Sub
If Target.Column = 7 Then
If LCase(Target.Value) = "post dated cheque" Then Target.Offset(, 7).Value = InputBox("Enter Due date")
End If
End Sub
 
Upvote 0

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
See if this fixes it
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Me.Unprotect Password:="dxb20"
If Target.CountLarge > 1 Then Exit Sub
If Target.Column = 7 Then
    If LCase(Target.Value) = "post dated cheque" Then Target.Offset(, 7).Value = InputBox("Enter Due date")
End If
Target.Locked = True
Me.Protect Password:="dxb20"
Application.EnableEvents = True
End Sub
 
Upvote 0
Solution
See if this fixes it
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Me.Unprotect Password:="dxb20"
If Target.CountLarge > 1 Then Exit Sub
If Target.Column = 7 Then
    If LCase(Target.Value) = "post dated cheque" Then Target.Offset(, 7).Value = InputBox("Enter Due date")
End If
Target.Locked = True
Me.Protect Password:="dxb20"
Application.EnableEvents = True
End Sub
hi,

I was trying the code, previously it was locking the cells after value is entered, now it is not; any reason?
 
Upvote 0
If you mean that the cell where the due date is entered was not being locked then this slight edit will fix it, the code would not have locked it previously unless a subsequent attempt to edit that cell was made.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Me.Unprotect Password:="dxb20"
If Target.CountLarge > 1 Then Exit Sub
If Target.Column = 7 Then
    If LCase(Target.Value) = "post dated cheque" Then Target.Offset(, 7).Value = InputBox("Enter Due date")
    Target.Offset(, 7).Locked = True
End If
Target.Locked = True
Me.Protect Password:="dxb20"
Application.EnableEvents = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,817
Members
449,049
Latest member
cybersurfer5000

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top