Solved Help Needed w/Prior VBA Code Adaptation

August 12, 2011 at 12:16:30
Specs: Windows XP

I would like to modify a prior code posted, and need help with the language. I'm not savvy at all with VBA, so my guesses have all been failures. Here is the post:

Here is the code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$1" Then Range("$A$2") = Now
End Sub

I would liike to be able to apply this to a whole column, but the only way I could do it with my limited knowledge is to enter it like this:

If Target.Address = "$G$2" Then Range("$H$2") = Now
If Target.Address = "$G$3" Then Range("$H$3") = Now
If Target.Address = "$G$4" Then Range("$H$4") = Now

(....add the cells one by one?? That's what I'm doing here, right??)

I know this is the "long division" way of doing it, and it absolutely works, but I don't know how to translate it to apply to the columns as a whole. That would be fine if I knew how many rows I was going to use. I can change the code to do what I need by defining the range differently, correct? How do I do that?

Help, please??

See More: Help Needed w/Prior VBA Code Adaptation

Report •

August 12, 2011 at 12:22:17
✔ Best Answer
Private Sub Worksheet_Change(ByVal Target As Range)
 If Target.Cells.Count = 1 Then
  Application.EnableEvents = False
    If Target.Column = 7 Then Range("H" & Target.Row) = Now
  Application.EnableEvents = True
 End If
End Sub

Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.

Report •

August 12, 2011 at 12:51:51
Who better to help then the original!?! Thanks so much!!

... and my apologies for lacking proper VBA posting ettiquite.... I definitely need to learn how to read/use/identify/edit/'do anything with' VB code.... thanks for the link!

Report •
Related Solutions

Ask Question