+ Reply to Thread
Results 1 to 3 of 3

Simple Error Checking

  1. #1
    Registered User
    Join Date
    10-11-2004
    Posts
    5

    Simple Error Checking

    Hi

    I have several macros associated with a worksheet, these macro's perform various simple functions, eg. insert rows, move rows up/down etc.

    What I would like is to know how to word error checking so that

    Rows cannot be moved above Row 7. (Rows 1-6 contain headings so I do not want a row 7 and Row 6 switched by running this macro.
    Rows 1-6 cannot deleted.

    Something along the lines of "If Activecell < A7 Then ErrorMessage" etc.

    Any ideas?

    Apologies if not clear.

    Regards
    Andy

  2. #2
    Ian
    Guest

    Re: Simple Error Checking

    Sub Top6Rows()
    If ActiveCell.Row < 7 Then
    MsgBox ("Not permitted")
    End If
    End Sub

    An easier alternative might be to unlock rows 6 &below, then protect the
    worksheet.

    --
    Ian
    --
    "AndyR" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi
    >
    > I have several macros associated with a worksheet, these macro's
    > perform various simple functions, eg. insert rows, move rows up/down
    > etc.
    >
    > What I would like is to know how to word error checking so that
    >
    > Rows cannot be moved above Row 7. (Rows 1-6 contain headings so I do
    > not want a row 7 and Row 6 switched by running this macro.
    > Rows 1-6 cannot deleted.
    >
    > Something along the lines of "If Activecell < A7 Then ErrorMessage"
    > etc.
    >
    > Any ideas?
    >
    > Apologies if not clear.
    >
    > Regards
    > Andy
    >
    >
    > --
    > AndyR
    > ------------------------------------------------------------------------
    > AndyR's Profile:
    > http://www.excelforum.com/member.php...o&userid=15203
    > View this thread: http://www.excelforum.com/showthread...hreadid=470669
    >




  3. #3
    Rob
    Guest

    RE: Simple Error Checking

    Sub SwapRows(FirstRow as long, SecondRow as long)
    if firstrow<=6 or secondrow<=6 then
    msgbox "Can't move title rows!"
    exit sub
    end if
    'your code to swap the rows
    end sub

    "AndyR" wrote:

    >
    > Hi
    >
    > I have several macros associated with a worksheet, these macro's
    > perform various simple functions, eg. insert rows, move rows up/down
    > etc.
    >
    > What I would like is to know how to word error checking so that
    >
    > Rows cannot be moved above Row 7. (Rows 1-6 contain headings so I do
    > not want a row 7 and Row 6 switched by running this macro.
    > Rows 1-6 cannot deleted.
    >
    > Something along the lines of "If Activecell < A7 Then ErrorMessage"
    > etc.
    >
    > Any ideas?
    >
    > Apologies if not clear.
    >
    > Regards
    > Andy
    >
    >
    > --
    > AndyR
    > ------------------------------------------------------------------------
    > AndyR's Profile: http://www.excelforum.com/member.php...o&userid=15203
    > View this thread: http://www.excelforum.com/showthread...hreadid=470669
    >
    >


+ 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