variable

  1. 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...
  2. 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...
  3. 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 =...
  4. 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...
  5. 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...
  6. M

    VBA Macro: How to reference LastColumn variable in a simple formula

    GOAL: I have a report that will grow by one column of data each day. Each day, I need to add a formula into the first empty column that will find the difference between the value in the last column and another fixed column that will never change. PROBLEM: I have successfully set my variable...
  7. C

    Variable value not passing from function

    Hi, I am a complete VBA beginner so I expect this a very easy question. In the below am trying to check if a file exists. In the below when I check the value of bExists using a Msgbox at the end of the function, the value is true and this is correct. However, if I at the end of the...
  8. B

    VBA - Create Power Query with source and name as variable from Excel sheet

    Hello, I am currently trying to create a Power Query with Excel VBA. I have stored the name and the data source of the Power Query table in an Excel sheet. I now want to start the makro for creating an Power Query table but the makro should read the name and the source of the data from the Excel...
  9. B

    VBA Using range variables for sumifs formula

    HI Guys need some help with this one - Done some searching but couldn't find anything that helps with my particular challenge here The excel function I would to return via vba in Cell L3 is =SUMIFS(G3:G12,H3:H12,"Sales",I3:I12,"<>Excluded")/38 I want to achieve this using VBA and use...
  10. C

    Function with variable reference

    Hi everybody, I am very glad to join you. I have recently started to use vba and so far i am very thrilled about it. I am trying to a enter a function and i am facing the following problem: Dim u As Integer For u = 2 To t - 1 'I calculated the value of variable t earlier in my...
  11. S

    Define a list of files as a variable target (VBA)

    Hello, I use a code to copy files to a template file, and delete old one, then save as old file's name. But choosing every single file for like 500 files, is very boring. Since, I do this operation once a week, now I need more clever way to do it. I use "GetOpenFilename" in order to choose...
  12. K

    Set a variable for workbook name

    So I need to set a workbook name as a variable as it changes every time an updated version is downloaded. So far here is the macro I have set. The problem occurs because the workbook name, which today is "MasterMDs-2020-01-27" will change constantly for the current date. Initially thought of...
  13. K

    Format Month Number Variable as mm ?

    I am writing a script that will save files to a new monthly directory for 3 months in advance. Directory naming convention is this: 04-April 2020 I can get the year and I can get the month name. I can get the month number to return 4, but I need 04. FY = Year(Date) FM =...
  14. E

    Title a Sub Routine with a variable.

    I have over a dozen checkboxes. They are titled checkbox1, checkbox2, checkbox3... etc. They each have a sub routine that tells them what to do when click. These subroutines are identical except for the number that indexes each checkbox. While this was easy to create using copy/paste. It is...
  15. H

    Variable workbook declaration

    Hello I have a workbook that contains data and a VBA to do some tidying up and formatting. I need to be able to open up 2 other workbooks to do a vlookup on, the problem I have is the 2 workbooks change name everyday. How do I declare these other 2 in my main workbook. Any suggestions would be...
  16. T

    For Each Loop

    Following from this thread: https://www.mrexcel.com/forum/excel-questions/1114405-collections.html I was told this piece of information: Syntax ... For Each element In group ... element ... For collections, element can only be a Variant variable, a generic object variable, or any...
  17. V

    Declare a variable to a cell

    Hi everyone! I've been stuck with declaring a variable to a cell value and need some help. Situation: I have a code that filters a table and transfers the filtered data to another sheet. The filter could be the date value but I can't set it properly. The result is always Error 1004. I've tried...
  18. I

    Missing values per case

    Hello! I am new to excel and have learned a lot from these messages boards and hope to keep the learning momentum going. I have a large dataset with over 25k rows and hundreds of columns. I would like to delete rows (participants) who have over 50% missing values per variables. Each column...
  19. gravanoc

    How can I set a range variable that only includes cells in that range with data?

    I have a very slow subroutine that uses a For Each statement to iterate through about 30 cells in a pre-defined range, checking if they have text in them, and then performing a bunch of formatting based on the text in that cell. I'm wondering if there is a faster way to do this that would...
  20. B

    Looking up data in other worbooks

    I have a table where I have to draw data from a number of workbooks While the table is across multiple columns, it is between rows 2 and 201 So in cell AB2 I have this formula =VLOOKUP($A3,[Trap12.xlsm]Squadding!$K$3:$P$202,2,FALSE) This is the formula I tried to pick up the variable which is...

Watch MrExcel Video

This Week's Hot Topics

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