Results 1 to 6 of 6

Thread: [RESOLVED]It used to function - now it doesn't!!!

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    96

    Resolved [RESOLVED]It used to function - now it doesn't!!!

    Hi all

    I've made a module for organizing special types of input at work. after several problems I finally found a way to make it work - Then I made it into a template and it still worked all right.... Know I need to use it again and all of a sudden I'm getting a "range" error on object "worksheet".... WHY???

    My code is very simple, since I'm using processing sheets, thus I'm merely copy/pasting... Code as follows;

    VB Code:
    1. Sub flexvalue()
    2. Dim j As Double
    3. Dim k As Double
    4. Dim iSheet As Worksheet
    5. Dim nSheet As Worksheet
    6. Dim rSheet As Worksheet
    7. Dim nkSheet As Worksheet
    8.  
    9.     Set iSheet = ActiveWorkbook.Sheets("Input")
    10.     Set nSheet = ActiveWorkbook.Sheets("Nedskrivning-Lån")
    11.     Set rSheet = ActiveWorkbook.Sheets("Resultater")
    12.     Set nkSheet = ActiveWorkbook.Sheets("Nedskrivning-Kredit")
    13.    
    14. Application.ScreenUpdating = False
    15.     nSheet.Activate
    16.    
    17.     For j = 2 To 10000
    18.         nSheet.Cells(20, 16).Value = iSheet.Cells(j, 16).Value
    19.             iSheet.Activate
    20.             If iSheet.Range(Cells(j, 16), Cells(j, 16)).Value > 0 Then
    21.                 iSheet.Range(Cells(j, 1), Cells(j, 1)).Copy
    22.                 rSheet.Activate
    23.                 rSheet.Range(Cells(j, 1), Cells(j, 1)).PasteSpecial Paste:=xlValues
    24.                 iSheet.Activate
    25.                 iSheet.Range(Cells(j, 3), Cells(j, 5)).Copy
    26.                 rSheet.Activate
    27.                 rSheet.Range(Cells(j, 2), Cells(j, 4)).PasteSpecial Paste:=xlValues

    and so forth...

    As I said - used to work, now it doesn't?

    /Nick
    Last edited by direktoren; Apr 18th, 2006 at 07:26 AM. Reason: resolved

Posting Permissions

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



Click Here to Expand Forum to Full Width