Hi..
I have two macros i want to be activated by changes made on sheet..
i know they both work separately, but i cant get them to work together
the first is tricked by changes in column C:C
the other is tricked if there is entered and "X" in F:F
Private Sub Worksheet_Change(ByVal Target As Range)
Dim strAddress As String
Dim val
Dim dtmTime As Date
Dim Rw As Long
If Intersect(Target, Range("C:C")) Is Nothing Then Exit Sub
dtmTime = Now()
val = Target.Value
strAddress = Target.Address
Rw = Sheets("Log Sheet").Range("A" & Rows.Count).End(xlUp).Row + 1
With Sheets("Log Sheet")
.Cells(Rw, 1) = strAddress
.Cells(Rw, 2) = val
.Cells(Rw, 3) = dtmTime
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
Dim x As Integer
Dim y As Integer
Dim z As Integer
Dim i As Integer
Dim Msg As String, Ans As Variant
i = Worksheets("Historik").Range("A1").CurrentRegion.Rows.Count
For x = 1 To 9999
If Cells(2 + x, 6) = "x" Then
If MsgBox("Er du sikker på at du vil flytte denne til historik?", vbYesNo, "Overfør til historik?") = vbYes Then
z = z + 1
Worksheets("Historik").Cells(i + z, 1).Value = Cells(2 + x, 1)
Worksheets("Historik").Cells(i + z, 2).Value = Cells(2 + x, 2)
Worksheets("Historik").Cells(i + z, 3).Value = Cells(2 + x, 3)
Worksheets("Historik").Cells(i + z, 4).Value = Cells(2 + x, 5)
Call UpdateAction
End If
End If
Next
Call slet_x
Application.ScreenUpdating = True
End Sub
Can any on help?
Bookmarks