• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Drop down selection comments change validation

Posky

New Member
HI All,

I have a macro with a helper cell that enables to me to change the drop down and the comments change as the selection on the drop down change, however I would like to have a few columns like this as well as would like to drag it from 1 cell all the way to the whole column. At the moment the macro only perform this for 1 cell $G$2.

See attached sample file

The code:-

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = "$G$2" Then
Set Cmnt = Target.Comment
If Cmnt Is Nothing Then
Target.AddComment Text:=Cells(2, "E").Text
Else
With Cmnt
.Text Text:=ActiveSheet.Cells(2, "E").Text
End With
End If
End If

End Sub


Thanks
 

Attachments

  • VAT Matrix Goods_PI.xls
    810.5 KB · Views: 6
This will do it for all cells in Ciolumns B:D

Code:
Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column => 2 and  Target.Column <= 4 Then
Set Cmnt = Target.Comment
If Cmnt Is Nothing Then
Target.AddComment Text:=Cells(Target.Row, "E").Text
Else
With Cmnt
.Text Text:=ActiveSheet.Cells(Target.Row, "E").Text
End With
End If
End If

End Sub
 
Hi Hui,

Thank you very much for the amended code, really useful, however I was trying so hard to write a code for different sets of selection to be used in the sheet. so I added a module with a separate code on the first sheet. It works for 1 however I am stuck with adding more selections from the definitions tab. See attached..

This is only hurdle- I was trying all night yesterday:(

Thanks in advance for your expertise
 

Attachments

  • VAT Matrix Goods_PI.xls
    816.5 KB · Views: 2
Back
Top