variable

  1. C

    macro to create vbs and pass variable

    The variable to pass is EMailVar Q: need to know how to setup vbs to receive variable Option Explicit ' create a vbs script to receive a variable parameter and send email. 'run vbs script by passing variable 'wait for process to complete 'kill script Sub writeVBScript() Dim s As String...
  2. D

    Declare a variable containing a variable

    Hello all, I have a very simple table date, product code, units and have created a running total measure that allows me , when dropped into a pivot table to retain all of the product I'd 's while only returning a running total for one, in this case 'a' . < abc := VAR mdate = MAX (...
  3. F

    Count (countifs) norm exceedances with variable dates and variable norms formula or VBA

    Hey everyone, I have substance measurement data from water quality checks. The data is listed in a table starting with the date (dd/mm/yyyy). Above the table are the norms. The variable norms are in green. Those norms are generated on a second tab, and change (sort of) weekly. I need to...
  4. S

    sheet name variable not working in vlookup

    I have multiple tabs and will be moving from one to the next. so I need to have a variable that has the tab name...so that I can use it later. 1. saved the tab name as a variable 2. want to use that saved tab name in a vlookup 2a. the tab name is alaska 2b. the chart that is being...
  5. C

    DAX: table variables that can be shared between measures?

    I am analyzing data about employee headcount and I am looking for a way to simplify my formulas. My end goal is to be able to have measures that give me headcount on a given date, how many employees were gained between the given date and the previous month, how many were lost between the given...
  6. H

    Execute VBA code stored in variable

    Hi, I'm trying to execute VBA code stored inside a variable, but so far no luck. I can compare it to PowerShell where you're able to do this: $currentuser = whoami PS C:\Users\testuser> $currentuser azuread\testuser PowerShell will execute "whoami" when you run $currentuser. If i try to...
  7. G

    Need to assign specific charts to variables

    Hi Folks, I am trying to figure out the syntax to assign individual charts to individual variables in my macro rather than loop through each chart to send them to PowerPoint. Using the syntax below throws a run-time error 91, Object variable or With block variable not set even though I have...
  8. T

    VBA Find cell address with text to use as range variable

    In a workbook with multiple sheets, I want to find the address of a cell containing the string "MIS", which will always be in a sheet in which cell A1 begins "P " (with a space after the letter P). I then want to save this address to a range variable and pass it to another sub which will set the...
  9. G

    Passing Variable in URL (Power Query)- Loop vs Parameter

    Hello everyone, and happy almost Thanksgiving! I am working on a project in Power Query and need advice as to how I should pass a variable in my URL. The URL is for free access to an API that allows 100 combined request/day. The original URL has a spot where a UPC code can be changed to...
  10. H

    VBA that will update all existing formulas path and name to X

    Imagine I have my original workbook called 001.xlsx, in cell A1 I have the below formula already saved: ='C:\Users\mbxyz\File_001\[001.csv]Sheet1'!A1 This formula is returning the value from that specific cell, from that new workbook, from that folder. Now I need the 001 to be a dynamic...
  11. wsnyder

    Evaluate Variable At Run-Time

    Hi, Using Excel 365. How do I evaluate a variable at run-time? The code below is returning sp1, sp2, sp3 I am trying to evaluate the variable as Alpha, Bravo, Charlie, Thanks -w Sub foo2() Const sp1 As String = "Alpha" Const sp2 As String = "Bravo" Const sp3 As String =...
  12. O

    Excel VBA - Dynamic value if a condition is true, add it

    Hi there, I am trying to highlight each row where a value is present in another list of values (it doesn't need to be in the same order, just needs to be present) This is a line of code in SAP that highlights the row(s). In this example, it highlights all rows 0-11 (starts at 0 because of a 0...
  13. G

    VBA: How to declare a variable and set initial values in one line?

    Hi, I want to write variable declaration and set the initial values in one line. I see some examples for that, but it doesn't work in my excel. Here are some examples that failed: Dim longArray() As Long = {0, 1, 2, 3} Dim longArray As Long() = {0, 1, 2, 3} Dim longArray = New Long() {0, 1, 2...
  14. H

    Compare Dataset Counts Using Multiple Parameters

    Hi everyone, I'm migrating data from a legacy source information system to a new information system and want to confirm a variety of counts of values from the source data against the counts of the same values from the migrated data to ensure the counts match as a way to verify the records...
  15. S

    Use Date result from one query to filter another query

    Hi, I have very basic VBA knowledge so please go easy on me :) I have a query "qry_Data_Ref_Wk_Date" which returns a Min Date "ProcessDate". I would like to use "ProcessDate" to apply an After Date Filter to another query "qry_Data_Filtered" by whatever means works best and stops me having to...
  16. M

    VBA DATE on open with variable based on time

    Good evening everyone I hope you can help me with this. I've searched high and low and have found my googling skills to be lacking for this. I'm looking at having VBA give a date based on time from sheet1 to Blank Officer on workbook open. this is some of the coding I have put together but its...
  17. E

    VBA Perform Autofill formula in specified column name/location

    Hello, I have a VBA macro that will insert a new column (titled updated col..) to the right of the specified column name. Then I use a VLOOKUP and autofill in the new column to provide the updated values. The column location of the updated column is variable/dynamic. How can I make the autofill...
  18. I

    variable using formula

    Hello Excel users The following two rows works fine. They check if value in cell C4 is correct (202102) and return the value in a modified shape to the cell A1 (2021-02). Range("A1").Select ActiveCell.FormulaR1C1 =...
  19. M

    Using a Variable array in place of a Vlookup to return values to VBA code

    I have a set of sheets which contain data which I pull into my VBA code with vlookups. The input data is collected into a table of data 10 columns wide, the key field is always an integer between 1 and 3000 but depending on the data entered by the users I might have 5 entries or 3000. The...
  20. A

    Put a variable in bold character in VBA

    Hello, I have a VBA sub sending an email with outlook. I am looking to have some parts in Bold characters. I thought of using .HTLMBody in the code based on some posts I saw. Where’s the catch? Well the parts I’m looking to put in bold characters are variables from a worksheet... I did...
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