subroutine

  1. K

    subroutine

    i have initiated value for some variable inside a module and called a subroutine.Inside that subroutine i have formula which uses those variables.will the subroutine recognize those varibles and their respective values even if i dont pass those values as arguemetns into subroutine?
  2. P

    Passing the HorizontalAlignment property to a Subroutine

    The Font Size and the HorizontalAlignment of Text in various rows will have to be different. So, when the programme moves from one Row to the other I am trying to pass to a Subroutine the Font Size whether 10 or 11 and the Alignment property whether xlCenter or xlLeft. I select a range and I...
  3. D

    passing sheet address to subroutine

    what is a correct way to access a open workbook.sheet that is currently open when linking to a subroutine or a function? ie.. i open two workbooks in the main routine and the based on a condition in the main routine i link to a subroutine. I can't figure out how to read a value on the open...
  4. S

    Cancel printing based on another macro

    I've got a subroutine 'Print_Report' that calls another subroutine 'Check_Fields' and basically, if certain cells are empty then 'Check_Fields' exits the subroutine, but 'Print_Report' continues to run. How can I make one subroutine exit based on something in another subroutine? I tried using...
  5. A

    End Main Sub on vbCancel within called Subroutine

    As title says, I have a main sub that calls a subroutine that displays a Retry/Cancel Msgbox. On cancel, I want to Exit the subroutine AND not return to the main sub. Currently I have an Exit Sub on cancel, but it only quits the subroutine and continues on the next line of the main sub. Do I...
  6. JenniferMurphy

    Can a UDF pass a ParamArray to a subroutine for processing?

    I am working on a UDF with several keyword parameters that I am passing from Excel as a ParamArray. To keep the main UDF simpler, I would like to pass the entire ParamArray to a subroutine for processing. I can't get it to work. Here's what I've tried: ' This is the main UDF as called from...
  7. S

    Trying to use "Call" to make a jump to 2nd subroutine but it always gives me errors

    I'm trying to use subroutine for Beforedoubleclick for all available sheets regardless of name or number and (Call Worksheet_BeforeDoubleClick) is giving me various kind of error and won't go to that subroutine. Please assist. Here's my code Sub Dosomething() Dim pSheet As Worksheet...
  8. P

    Determine if Cell Value is +1 or -1 Value to any Cell Values in Row Above

    I'm hoping to get some advice on what functions are best to use or a subroutine to determine if a cell value is one value more (+1) or less (-1) any of the cell values in the row above it. If true, I simply want to identify it by placing the letter "A" in a cell, else, leave blank. The "A" or...
  9. Y

    Way to execute vba code out of a cell w a double.click

    In Access & VB a field has the functions/methods where you can execute code subroutine on double.click. I see how to call a subroutine from a button... It seems there should be a call like Range.ondblclick
  10. R

    accessing variant after macro has ended

    I have a public variable declared in a Module, that's triggered by worksheet change event; My public variable ceases to exist after the Module subroutine completes. How do I preserve a Public variable in memory, for use later on? Is there a way? Basically want to be able to retrieve that...
  11. B

    VBA Timestamp/Run-time error 13

    Hello all, First time posting, I'm having trouble with a simple VBA sub I've been working on. The idea is that the code drops a timestamp into a specific cell when the Plan-Do-Check-Accept (PDCA) status of that row changes. Sub Worksheet_Change(ByVal Target As Range) Dim D As Range: Set D =...
  12. S

    Executing a Subroutine on a cyclical basis using time as a condition for execution

    Greetings, I am interested in building a subroutine that imports external data from using a web query on a cyclical basis, one day, one week, one month, or one quarter. I would like to know if anyone has experience in doing this and if so how might be best to structure the block of code that...
  13. R

    VBA autofilter restarting subroutine

    About to throw my computer across the room. I've got a sub routine named 'Private Sub FullRosterListBox_Click()' that applies to a combobox on a user form. When the user selects a name from the combobox, i want to populate other fields on the user form with the appropriate data. One of the...
  14. S

    Questions on Storing Macros

    Greetings, Typically I access my macros via Tools --> Macro-->Macros. This brings up the Macros window and I can navigate to the macro I want to work on. I prefer to save my macros so that they are visible in the Macros window in the form "PERSONAL.XLS!Macro_Name". As I understand a public...
  15. C

    Passing Checkboxes as variables

    Hi everyone, I have built a Subroutine and one of the required variables is a Checkbox. The Subroutine needs to check if a specified Checkbox has been ticked or not. Here is the declaration of the Subroutine with the Checkbox variable being the last one called "SwitchBox" (Have I used the right...
  16. 2

    Combining two subroutines

    My goal is to use the range objects from subroutine A toexecute subroutine B. To do this, I’d like to combine subroutine B intosubroutine A. I was going to attach the spreadsheet to show you what I mean, but I don't have permissions to do that. Basically, if you could help me on my syntax (I...
  17. B

    What happens from pressing a VBA userform button twice?

    So I am trying to understand what exactly happens if you press a VBA command button twice if it runs a subroutine. For instance does the first execution of the subroutine run by the button stop mid code and restart since the button was pressed again? I am trying to set up some ADO connection...
  18. D

    Run multiple subroutines to completion with one button click

    This is kind of complicated, so let me see if I can do it justice with an explanation that doesn't take 10 pages. I am working on a scheduling workbook for another department at our firm. They use it to keep track of what everyone in that department is projected to work on over the course of...
  19. M

    WorkSheet_Change for Multiple Sheets

    I have an extensive Worksheet_Change subroutine that works perfectly on Sheet6 where it is located. The routine is written so that everything accesses "activesheet" rather than the sheet name. I have parallel structures on Sheet3 and Sheet9 but they are not accessing the subroutine. I tried...
  20. Y

    Set pMod = ActiveSheet.PivotTableWizard failure

    Out of the blue......having used this piece of code in a pivot table creation subroutine for quite some time......."Set pMod = ActiveSheet.PivotTableWizard" throws an error: Run-time error Object variable or With block variable not set" This subroutine worked perfectly fine a month ago. And...

Some videos you may like

This Week's Hot Topics

Top