Consulting

Results 1 to 3 of 3

Thread: I need help edit code vba automatically copy of cell

  1. #1

    I need help edit code vba automatically copy of cell

    Hi
    I need help edit code macro automatically copy of cell and paste to other cell
    I need also copy cells and past in row 4


    Private Sub Worksheet_Calculate()
        Dim c As Range
        Application.EnableEvents = False
        On Error Resume Next
        For Each c In Range("h7:h" & Cells(Rows.Count, "H").End(xlUp).Row)
            If c = "Yes" Then
                c.Offset(, 1).Value = "Yes"
                If c.Offset(, 2) = "" Then
                    c.Offset(, 2).Value = c.Offset(, -7).Value
                    c.Offset(, 3).Value = c.Offset(, -6).Value
                    c.Offset(, 4).Value = c.Offset(, -5).Value
                    c.Offset(, 5).Value = c.Offset(, -2).Value
        
                End If
            End If
        Next c
        Application.EnableEvents = True
    End Sub
    Attached Files Attached Files

  2. #2
    Quote Originally Posted by etheer
    Hi
    I need help edit code macro automatically copy of cell and paste to other cell
    I need also copy cells and past in row 4


    Private Sub Worksheet_Calculate()
        Dim c As Range
        Application.EnableEvents = False
        On Error Resume Next
        For Each c In Range("h7:h" & Cells(Rows.Count, "H").End(xlUp).Row)
            If c = "Yes" Then
                c.Offset(, 1).Value = "Yes"
                If c.Offset(, 2) = "" Then
                    c.Offset(, 2).Value = c.Offset(, -7).Value
                    c.Offset(, 3).Value = c.Offset(, -6).Value
                    c.Offset(, 4).Value = c.Offset(, -5).Value
                    c.Offset(, 5).Value = c.Offset(, -2).Value
        
                End If
            End If
        Next c
        Application.EnableEvents = True
    End Sub


  3. #3
    So what is it that the code does or does not?
    It seems to work, unless I misunderstood your question.

    Why the "enable events" and the "on error resume next"?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •