Re: VBA Excel “Set” question

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Tom Ogilvy wrote:
You can't use a public variable in one workbook in another workbook.

You can.
Open first workbook with your variable, open second workbook, go to VBE open Tools/References and add your first workbook to a list of references of the second workbook.
Of course it is problematic when your try to move such combination to another computer, but it works.


Another solution is to have functions which set and return value of such variable and call then using Application.Run

To call function you don't have to reference it.
.



Relevant Pages

  • Re: Copying formulas to other workbooks
    ... If your two worksheets ... This will remove all of the references to the first workbook. ... Take care ...
    (microsoft.public.excel.programming)
  • RE: use a macro to close a file
    ... This way I do not need to remember to reset the Message Alert system. ... >> information to past into the first workbook then closes the second workbook. ... >> Thank you in advance Dan ...
    (microsoft.public.excel.programming)
  • RE: use a macro to close a file
    ... Be sure to reset it at the end of your code as follows: ... > information to past into the first workbook then closes the second workbook. ... > Sub Load_Group ...
    (microsoft.public.excel.programming)
  • Re: Close Workbook #2 Before Close
    ... Mudraker gave you a fix for that - however, if the second workbook were ... being opened because you created a reference to it from the first workbook - ... > The second workbook opens with this: ... > Private Sub Workbook_BeforeClose ...
    (microsoft.public.excel.programming)
  • Re: Problem with VLookup.....
    ... You can record a macro while you insert a new column A, ... The first workbook had had people entering for a very very long time, ... job number job description and job writer in that order... ... columns so that in the second workbook, vlookup could be used to find ...
    (microsoft.public.excel)