Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I have a worksheet shere I periodically update the data in a range. The
column to the right of the range displays the date when I last updated that row of data (see code below). I would like to change the code so it will do the same thing with whatever named range I include. This is what I have: Private Sub Worksheet_Change(ByVal Target As Range) Dim WS As Worksheet Set WS = Worksheets("Sheet1") If Not (Application.Intersect(Target, Range("Skill1")) Is Nothing) Then With WS.Cells(Target.Row, 13) .Value = Now .NumberFormat = "mm/dd/yyyy" End With Exit Sub End If End Sub This is what I tried. I thought this way I could easily add additional ranges as ElseIf statements. I get an error, "Argument is not optional." Private Sub Worksheet_Change(ByVal Target As Range) Dim WS As Worksheet Set WS = Worksheets("Sheet1") If Not (Application.Intersect(Target, Range("Skill1")) Is Nothing) Then GoTo Revise_Date ElseIf Not (Application.Intersect(Target, Range("Skill2")) Is Nothing) Then GoTo Revise_Date Else: Exit Sub End If Revise_Date: With WS.Cells(Target.Row, Target.Range.Offset(0,1)) .Value = Now .NumberFormat = "mm/dd/yyyy" End With Exit Sub End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Refer to a Single cell in a name range | Excel Worksheet Functions | |||
Can a cell refer to a Range of cells? | Excel Discussion (Misc queries) | |||
Can a cell refer to range name/array of data previously set? | Excel Discussion (Misc queries) | |||
???Refer to a specifc cell in a named range | Excel Worksheet Functions | |||
How do I refer a Range to a Cell | Excel Worksheet Functions |