Need help with modifying a code.

Pol04

New Member
Joined
Jun 29, 2015
Messages
5
I have this code that brings up a comment box in column B (to type something that would show in column B) whenever I type something in column A. Now I need this in a domino effect up until column D.

This is the code:

Private Sub Worksheet_Change(ByVal Target As Range)


Dim myComment As String
'
If Target.Column = 1 And Target.Count = 1 Then
Application.EnableEvents = False
myComment = InputBox("Please enter data for column B, otherwise you entry will be deleted", "ENTER COMMENT")
If Len(myComment) > 0 Then
Target.Offset(0, 1) = myComment
Else
Target.ClearContents
End If
Application.EnableEvents = True
End If

End Sub





See below for sample. I need similar message when I input data in that box but asking for entry to be made for column C. Hope this makes sense.

Excel_sample.jpg
[/URL][/IMG]
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
You're clearing the Target if the comment is blank, what do you want to happen if 1,2 or 3 comments are blank?
 
Upvote 0
You're clearing the Target if the comment is blank, what do you want to happen if 1,2 or 3 comments are blank?

Yep it would be erased so they have to input the needed data or just put n/a. the idea is to remind them that all fields need entries.
 
Upvote 0
So if they enter comments for B and C but not D, you'd clear the Target and comments in B & C?
 
Upvote 0
So if they enter comments for B and C but not D, you'd clear the Target and comments in B & C?

Hi Sericom. Ideally no. So A is dependent on B. B dependent on C. C dependent on D. But if it is easier and less complicated to just clear all then that would be fine as well.
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,915
Members
452,366
Latest member
TePunaBloke

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