+ Reply to Thread
Results 1 to 3 of 3

Runtime 1004 error when insert.

  1. #1
    Registered User
    Join Date
    11-28-2003
    Posts
    39

    Runtime 1004 error when insert.

    This is the problematic code.

    It only gives the error when in shared mode. i think it may need a "Xl" somewhere???


    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Excel.Range)
    Application.EnableEvents = False
    Application.ScreenUpdating = False
    If Target.Column >= 2 And Target.Column <= 10 And Target.Row >= 5 And Target.Row <= 9 Then
    Set ws1 = Worksheets(1)
    For x = 10 To 19
    score = ws1.Cells(x, 12).Value
    scoreRow = x
    For y = x + 1 To 19
    If ws1.Cells(y, 12).Value > score Then
    score = ws1.Cells(y, 12).Value
    scoreRow = y
    End If
    Next y
    If scoreRow <> x Then
    ws1.Cells(scoreRow, 11).Cut
    ws1.Cells(x, 11).Insert
    ws1.Cells(scoreRow, 12).Cut
    ws1.Cells(x, 12).Insert
    End If
    Next x
    End If
    ThisWorkbook.Save
    Application.ScreenUpdating = True
    Application.EnableEvents = True
    end sub.

    any help would be great.

    PS; i do use shared mode.

  2. #2
    George Nicholson
    Guest

    Re: Runtime 1004 error when insert.

    Check Help about "Features that are unavailable in shared workbooks". There
    is a list of 20 or so things and "Insert or delete blocks of cells" is one
    of them. One allowable workaround would be to insert/delete an entire row,
    but I can't tell if that is appropriate in your situation.

    HTH,
    --
    George Nicholson

    Remove 'Junk' from return address.


    "mikewild2000" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > This is the problematic code.
    >
    > It only gives the error when in shared mode. i think it may need a "Xl"
    > somewhere???
    >
    >
    > Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
    > Excel.Range)
    > Application.EnableEvents = False
    > Application.ScreenUpdating = False
    > If Target.Column >= 2 And Target.Column <= 10 And Target.Row >= 5 And
    > Target.Row <= 9 Then
    > Set ws1 = Worksheets(1)
    > For x = 10 To 19
    > score = ws1.Cells(x, 12).Value
    > scoreRow = x
    > For y = x + 1 To 19
    > If ws1.Cells(y, 12).Value > score Then
    > score = ws1.Cells(y, 12).Value
    > scoreRow = y
    > End If
    > Next y
    > If scoreRow <> x Then
    > ws1.Cells(scoreRow, 11).Cut
    > ws1.Cells(x, 11).Insert
    > ws1.Cells(scoreRow, 12).Cut
    > ws1.Cells(x, 12).Insert
    > End If
    > Next x
    > End If
    > ThisWorkbook.Save
    > Application.ScreenUpdating = True
    > Application.EnableEvents = True
    > end sub.
    >
    > any help would be great.
    >
    > PS; i do use shared mode.
    >
    >
    > --
    > mikewild2000
    > ------------------------------------------------------------------------
    > mikewild2000's Profile:
    > http://www.excelforum.com/member.php...fo&userid=3276
    > View this thread: http://www.excelforum.com/showthread...hreadid=520245
    >




  3. #3
    Registered User
    Join Date
    11-28-2003
    Posts
    39
    SCORE BOARD

    What it is doing is:

    i have i col of 10 team names (team 1, team 2, etc) from K10 to K19
    Then from L10 to L19 i have the team scores.

    What the code is doing. It is tying to gether the team name cells with with cell holding it's score (K10 & L10, K11 & L11, etc)

    Then it is sorting the highest score to the top of the list but keeping the team names in place with the correct score.

+ 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