PDA

View Full Version : I need help edit code vba automatically copy of cell



etheer
03-21-2013, 09:51 AM
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

etheer
03-24-2013, 04:50 PM
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



:banghead::banghead::banghead:

jolivanes
03-25-2013, 12:17 PM
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"?