Results 1 to 6 of 6

Run-time error 7 out of memory vba

Threaded View

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    Serbia
    MS-Off Ver
    Excel 2010
    Posts
    85

    Run-time error 7 out of memory vba

    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.
    Last edited by Jovica; 08-19-2012 at 09:09 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1