View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
captedgar captedgar is offline
external usenet poster
 
Posts: 1
Default Clear Cell Content Query


Hi there

My Excel Vba shown below inserts time() into a particular cell on my
sheet.
Once inserted, is it possible to clear this cell before my vba code is
re-run?.
My VBA is only entering the time() once and not re-insering the time()
if i change the same cell values after some time i.e.

please advice

Below is my code which inserts time() into a cell.

Private Sub DateModifier(ByVal strTarget As String, ByVal strDestination
As String)
' Checks for a Yes or NA or RB(Rollback) value in strTarget and if
found, modifies the cell in strDestination
If (Range(strTarget + strCurrentRow).Value2 = "Yes") Then
If (Range(strDestination + strCurrentRow).Value2 = "") Then
Range(strDestination + strCurrentRow).Value2 = StaticTime
End If

' Check to see if Log has been rolled back
If (Range(strDestination + strCurrentRow).Value2 Like ("Rolled
Back*")) Then
Range(strDestination + strCurrentRow).Value2 = StaticTime
End If
End If

' Check for an NA status
If (Range(strTarget + strCurrentRow).Value2 = "NA") Then
If (Range(strDestination + strCurrentRow).Value2 = "") Then
Range(strDestination + strCurrentRow).Value2 = "NA"
End If
End If

' Check to see if strTarget changes to "No" but originally was yes
' (if a value is in strDestination we assume a log has happened)
' and append the log with Rolled Back and the date
If (Range(strTarget + strCurrentRow).Value2 = "RB") Then
If Not (Range(strDestination + strCurrentRow).Value2 = "") Then
If Not (Range(strDestination + strCurrentRow).Value2 Like
"*RB*") Then
Range(strDestination + strCurrentRow).Value2 = "RB" +
StaticTime
End If
End If
End If
End Sub




--
captedgar