passing variables

  1. J

    Using a variable inside a worksheetfunction

    I am trying to pass a variable into a function and it will not accept it. What is the syntax that I am missing to get it to use the variable in the worksheet function. Thanks in advanced I have been banging my head against for countless hours! Dim VARADD As String Dim VARSUM As String X = 0 Do...
  2. V

    Referring to variable present in macro from another workbook

    Hello, I want to get value of variable from macro which is present in another workbook. I tried below code. errmsg = errmsg & Application.Run("'" & filename & "'!appending_data").errm & vbnextline Obviously I messed with syntax. I am not into coding. Could you please help me with the same.
  3. E

    Passing Variables through Loops

    Can a subroutine both pass and call up variables? I am attempting a complex numerical iteration program that requires subroutines to both pass and call up variables. If it can't be done, is this a reason why I should switch to a Gnu Octave or Matlab program? Because my program is very...
  4. E

    Passing Global Variables by Value

    I want to create public variables, but always want to pass the current value of the variable from one procedure to another. For Example: ------------------- Option Explicit Public X as Long Public Y as Long Public Z as Long Sub A () X = 1 Y= 2 Z = X + Y Call B Worksheets...
  5. N

    Grabbing working directory and passing it as variable in macro

    I am trying to figure out how to grab the working directory and pass it as a variable via a macro. I am running a python script from a directory that is captured with user input and will always have a results subfolder. In the python script I am running Macro1 from an Excel template that is...
  6. D

    Trouble with UserForms and Variables

    Hi all, I new to the site and still a bit new to VBA. What I am trying to do is open a user form and allow the user to pick a file (perhaps a few files in the future) open it and display the file name with one button click. Then use another control bottun to do the work of getting the needed...
  7. U

    How can I pass an Array so I can get the verable count?

    I have a routine that counts variables but I have to pass a string so it knows which one to test. There has to be a better way. Private Function ArrayVariableCount(Arr As String) Dim nonEmptyElements As Integer, i As Integer ' nonEmptyElements = 0: i = 0...
  8. A

    Passing Arrays Between Subs

    I know I am doing this wrong but I what I am trying to do is pass an array from boxSelect_Change to subBox_Change. Then I want to reference that array inside subBox_Change. Is there even a way to do this? Here is my attempt: Private Sub boxSelect_Change() If boxSelect.Value <> "" Then...
  9. J

    Passing variables between code?

    Hi, I have an event trigger in my workbook (that monitors report delivery deadlines) that when the workbook is opened, it cycles through some defined sheets and alerts the user if a report is due that day. I'm in the seperate process of creating a module that will email a manager if a...
  10. E

    Calling Procedures in Another Workbook and Passing Variables

    Hello- I have a VBA Routine where I open workbook and run some code in the newly opened workbook that requires two input parameters...I've been trying to pass them ByVal however the debugger now does not recognize the Call to the procedure if I include the variables...anybody have any ideas on...
  11. R

    Passing Variables

    Please let me know how I can pass a variable from my double click code to my user form code. Here's what I have done and it does not work... In Sheet1-- Public TestTarget As Integer Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) Dim FileToOpen As...

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top