subroutine

  1. R

    Extra subroutine to crop values of one column to 10 characters

    Hi, I have this macro (see below - code scripting credited to member rlv01) and I would like to add a subroutine which crops all the values of column O to 10 characters only. So I want to only keep the first 10 characters of the data in every cell of the single column O. For example: if the...
  2. G

    Add a condition to a loop to check for date

    I've got a sub routine that works to apply a filter to conditions in column I. I need to add another condition that would only apply to the list set if a date condition is met. Need the date checked for today in Column L before applying . Sub AF() Dim RX As Object, d As Object Dim a As...
  3. T

    Merge duplicate and similar rows into new sheet

    The initial part of my query is similar to some other posts (although I am not adept enough at VBA to modify the code as needed to suit my purposes), but because the second part goes beyond what I've been able to find already on the forum, I thought I'd post the whole question here. I'm working...
  4. 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?
  5. 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...
  6. 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...
  7. 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...
  8. 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...
  9. 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...
  10. 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...
  11. 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...
  12. 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
  13. 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...
  14. 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 =...
  15. 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...
  16. 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...
  17. 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...
  18. 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...
  19. 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...
  20. 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...
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top