+ Reply to Thread
Results 1 to 3 of 3

macro which works in excel 2000 does not work in excel 2002

  1. #1
    Registered User
    Join Date
    06-16-2006
    Posts
    2

    macro which works in excel 2000 does not work in excel 2002

    Hi,

    I have this code in the Worksheet/SheetCalculate event of my excel sheet which was created in excel 2000. It works very well. However when the same worksheet in opened in excel 2002 and a cell value changed . It does not execute the function as the unprotect worksheet code does not work in excel 2002.

    Can anyone help me with this. This is my code which works well in excel 2000.

    ActiveSheet.Unprotect
    On Error GoTo ERRMSG
    ActiveSheet.Shapes("SudhirP").Select
    Selection.Cut
    Range("d22:d36").Select
    With Selection
    .HorizontalAlignment = xlLeft
    .VerticalAlignment = xlTop
    .WrapText = True
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .MergeCells = False
    End With
    Range("d37").Select
    ERRMSG:
    Range("d22:d36").Select
    With Selection
    .HorizontalAlignment = xlLeft
    .VerticalAlignment = xlTop
    .WrapText = True
    .Orientation = 0
    .AddIndent = False
    .IndentLevel = 0
    .ShrinkToFit = False
    .MergeCells = False
    End With
    ActiveSheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:=True
    Range("a1").Select

    thanks
    Neeta

  2. #2
    Don Guillett
    Guest

    Re: macro which works in excel 2000 does not work in excel 2002

    It should work. Perhaps you need to use the . 's in your with statements.

    ActiveSheet.Unprotect
    'On Error GoTo ERRMSG '?????
    ActiveSheet.Shapes("SudhirP").Cut
    with Range("d22:d36")
    ' .HorizontalAlignment = xlLeft'need?
    ' .VerticalAlignment = xlTop 'need?
    .WrapText = True
    End With
    'Range("d37").Select
    ActiveSheet.Protect DrawingObjects:=False, _
    Contents:=True,Scenarios:=True




    'don't understand this
    ERRMSG:
    Range("d22:d36").Select
    With Selection
    HorizontalAlignment = xlLeft
    VerticalAlignment = xlTop
    WrapText = True
    Orientation = 0
    AddIndent = False
    IndentLevel = 0
    ShrinkToFit = False
    MergeCells = False
    End With
    ActiveSheet.Protect DrawingObjects:=False, Contents:=True,
    Scenarios:=True
    Range("a1").Select

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "nnayak" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi,
    >
    > I have this code in the Worksheet/SheetCalculate event of my excel
    > sheet which was created in excel 2000. It works very well. However
    > when the same worksheet in opened in excel 2002 and a cell value
    > changed . It does not execute the function as the unprotect worksheet
    > code does not work in excel 2002.
    >
    > Can anyone help me with this. This is my code which works well in excel
    > 2000.
    >
    > ActiveSheet.Unprotect
    > On Error GoTo ERRMSG
    > ActiveSheet.Shapes("SudhirP").Select
    > Selection.Cut
    > Range("d22:d36").Select
    > With Selection
    > HorizontalAlignment = xlLeft
    > VerticalAlignment = xlTop
    > WrapText = True
    > Orientation = 0
    > AddIndent = False
    > IndentLevel = 0
    > ShrinkToFit = False
    > MergeCells = False
    > End With
    > Range("d37").Select
    > ERRMSG:
    > Range("d22:d36").Select
    > With Selection
    > HorizontalAlignment = xlLeft
    > VerticalAlignment = xlTop
    > WrapText = True
    > Orientation = 0
    > AddIndent = False
    > IndentLevel = 0
    > ShrinkToFit = False
    > MergeCells = False
    > End With
    > ActiveSheet.Protect DrawingObjects:=False, Contents:=True,
    > Scenarios:=True
    > Range("a1").Select
    >
    > thanks
    > Neeta
    >
    >
    > --
    > nnayak
    > ------------------------------------------------------------------------
    > nnayak's Profile:
    > http://www.excelforum.com/member.php...o&userid=35493
    > View this thread: http://www.excelforum.com/showthread...hreadid=552655
    >




  3. #3
    Registered User
    Join Date
    06-16-2006
    Posts
    2

    Macro worksin excel 2000 doesnot work in 2002

    Hi,

    I did not understand what .' meant. Do u mean I have to remark those codes which u have shown.

    The only command which does not work in the macro is the Activesheet.unprotect command . The rest of the code works well.

    What do I do to unprotect the active worksheet in my sheet.recalculate event

    thanks for u r reply

    regards
    Neeta

+ Reply to Thread

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