Consulting

Results 1 to 3 of 3

Thread: call code

  1. #1

    call code

    At the moment i have code that loops through a folder and formats reports.

    At the top of this code there is a few variables that i have defined in the code based on defined ranges in the workbook.

    effectively my code is:

    1) VARIABLES DEFINED (BASED ON DEFINED RANGES IN OPEN WORKBOOK WHERE MACRO STORED)
    2) CODE TO OPEN WORKBOOKS IN DEFINED FOLDER
    3) CODE TO FORMAT REPORTS (CALLED IN FROM OTHER SUB)
    4) CODE TO EXIT WORKBOOK & LOOP ROUND
    5) SOME OTHER FORMATS TO CENTRAL WORKBOOK WHERE MACRO STORED


    The formats that i call make reference to the defined variables - however they dont seem to be recognised.
    They worked fine before when i have one long list of code (i recently changed so that i called the formats in as a seperate sub).
    It seems that when a different workbook is opened then obviously the defined names arent in this one so it doesnt recognise them and kicks it out as an error.
    However they are defiend in the main set of code at the top when in the right workbook?

    what am i doing wrong?

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Post the code.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    hi thanks, i managed to google it- i just needed to make them public variables

Posting Permissions

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