mark jay
mark jay

Reputation: 19

run vba script for cells in column after specific row

I am using this code so when a user clicks on AQ in a column, the subsequent cell AS in that row is updated with the date.

However i am trying to get this to only work on those cells which are in row 8 or higher, so in other words i dont want rows 7,6,5,4,3,2,1 affected.

Is there a way i can say if row is 8 of higher? or 8-37?

also is there a way to only run this code when cell AQ = certain text? else otherwise do nothing?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  If Target.Column = Range("AQ8").Column Then
    Range("AS" & Target.Row).Value = "=TODAY()"
  End If
End Sub

thanks

Upvotes: 0

Views: 2003

Answers (1)

cronos2546
cronos2546

Reputation: 1106

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row > 8 And Target.Column = 43 And Target.Value = "Send Email" Then
       Target(1, 2).Value = Date()
    End If
End If
End Sub

Nested in the worksheet module.

Upvotes: 3

Related Questions