This is my first post here and second day trying to use VBA to solve some problems/shortcuts in Excel (I'm learning by trial and error).
Using macros and help from this forum I was able to sort some code that I was happy with.
Problem is when I use second macro (that I found on the net-which is working in blank workbook) I get "Run-time error 7 out of memory"
in first macro which I am not using at the time.
The problem is in the third line "If Target.Column = 20 And Target.Value = "B" Then"
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
With Sh
If Target.Column = 20 And Target.Value = "B" Then
'ThisRow = Target.Column
'If Target.Value = "B" Then
ActiveCell.Offset(-1, -7).Select
Selection.Copy
ActiveCell.Offset(0, -3).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "=TODAY()"
'Range("B25").Select
Selection.NumberFormat = "dd.mm.yyyy."
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveCell.Offset(0, -9).Select
Selection.Style = "In Position"
Else
If Target.Column = 20 And Target.Value = "S" Then
ActiveCell.Offset(-1, -7).Select
Selection.Copy
ActiveCell.Offset(0, 8).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveCell.Offset(0, 1).Select
ActiveCell.FormulaR1C1 = "=TODAY()"
'Range("B25").Select
Selection.NumberFormat = "dd.mm.yyyy."
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveCell.Offset(0, -20).Select
ActiveCell.Resize(, 11).Select
Selection.Style = "Disabled"
Else
If Target.Column = 20 And Target.Value = "W" Then
ActiveCell.Offset(-1, -18).Select
Selection.Style = "Waiting"
End If
End If
End If
End With
End Sub
Thanks for help in advance.
Bookmarks