Hello I'm inexperienced in VBA, been digging around and trying different things but I still can't figure out how to get my two macros to run at the same time in the same worksheet. If I open two different excel tabs and use the codes seperately, they each do their own purpose. But I can't figure out how to merge them in one excel worksheet. It seems it's not as easy as just deleting the "End Sub" and "Private Sub Worksheet_Change(ByVal Target As Range)" in the middle to combine them. When I enter something in cell B1 I would like it to cut and paste to the A column (starting at A2) and then also populate the date in the cell next to it. Here are the two macros:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("A2:A100")) Is Nothing Then
With Target(1, 2)
.Value = Now
.EntireColumn.AutoFit
End With
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("B1")) Is Nothing Then Exit Sub
Application.EnableEvents = False 'to prevent endless loop
Dim last_row As Long
last_row = Range("A65536").End(xlUp).Row
Range("B1").Copy
ActiveSheet.Paste Destination:=Range("A" & last_row + 1)
Range("B1").ClearContents
Application.CutCopyMode = False
Application.EnableEvents = True
End Sub
Bookmarks