+ Reply to Thread
Results 1 to 8 of 8

How to shorten the code?

  1. #1
    Registered User
    Join Date
    06-05-2008
    Posts
    12

    How to shorten the code?

    Hi,

    Recently,I want to take the check the data in xlsheet_l is it the same data as xlsheet, some of the data will be transfered to xlsheet_l. I was able to run the few lines of code well. However, when I procedured to write similar code. I was unable to run my code as it encountered this pop up which stated that "out of procedure" . I feel that maybe my code is too long as result it comes with this " out of procedure" Is there any way to shorten my code?

    Please Login or Register  to view this content.
    Last edited by shg; 10-29-2008 at 12:27 AM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    In your lm_c6 loop, you suddenly have the variable lm_c3 as part of your cell definition in the Union. Is this correct? If not, then correct and see if you still have the same error.

    rylo

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    I've edited your post to add Code Tags. Please read the Forum Rules before posting again.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    06-05-2008
    Posts
    12
    Thanks.I have change the code which you mentioned. However, the same error come out. what could be problem?

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Code has to appear in a procedure (a sub or function), e.g.,
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    06-05-2008
    Posts
    12
    Thanks.I have tried using function or sub before in the code. However, it didn't work. Is it because I have too many looping which result in this out of procedure?

  7. #7
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Hi

    See if this works. If I understand your code, the data from sheet1 will be moved to sheet2. This is running on my machine.

    If this doesn't match your setup, can you please put up an example file showing what data should be moved where....

    rylo
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    07-02-2008
    Location
    Fort Worth, TX
    Posts
    99
    Code always has to be surrounded by the sub/end sub or fuction markers to mask them, otherwise it is out of the coding box and can't be read.

    Also, does it highlight any specific line when you click on debug?

+ 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