title: For Each Loop update cell
body: <p>Hello guys I'm trying to update some of my cell with currentdate, so i did the following, but was not able to update the cell.</p>
  
  <p>EDIT: to add in the missing function from the entire code.</p>
  
  <pre><code>Sub GetField32AFromCell()
  
      For Each Cell In Worksheets("MM_Creation_Success").Range("G2:G9")
  
          'Get cell which is right side of the current cell in for each loop
           Dim nextRange As Variant: nextRange = Cell.Offset(0, 1).Value
  
          'split the value of the cell into string array
           Dim splitString() As String: splitString = SplitStringByNewLine(Cell)
  
           For Each sString In splitString
  
               Dim newLine As String: newLine = sString
               newLine = TryGetField32A(newLine)
  
               If Not newLine = "" Then
  
                   Dim newDateString As String: newDateString = GetCurrentDate("yymmdd")
                   Dim new32AField As String: new32AField = Mid(newLine, 7)
  
                   new32AField = newDateString + new32AField
                   'Set nextRange = new32AField
                   'MsgBox (nextRange)
               End If
           Next
       Next
  
  End Sub
  
  
      Public Function SplitStringByNewLine(stringArray As Variant) As String()
          SplitStringByNewLine = Split(stringArray, Chr(10))
      End Function
  
      Public Function TryGetField32A(newLine As String) As String
          If newLine Like ("*:32A:*") Then
          TryGetField32A = Mid(newLine, Len("*32A::"), Len(newLine))
          'MsgBox ("Found Tag 32A: " + field32AVal)
      End If
      End Function
  
      Public Function GetCurrentDate(dateFormat As String) As String
          Dim todayDate As String: todayDate = Format(Date, dateFormat,         vbMonday, vbUseSystem)
          GetCurrentDate = todayDate
          'MsgBox ("Current Date in Format (" + dateFormat + "): " + todayDate)
      End Function
  </code></pre>