string variable

  1. B

    VBA to Open an excel file using Inputs

    I'm trying to get this code to open a file for me: Sub openfile() Dim A As sting Dim B As String A = Application.InputBox("type value of A here:") B = Application.InputBox("type value of B here:") Workbooks.Open Filename:= _ "D:\Users\" & A & "\Documents\" & B & ".xlsx" End Sub...
  2. S

    VBA; String variable; If Statement; Empty cell

    Dear Forum Members, I am hoping you can assist a newbie here. The following is required from my VBA code: A cell input is made in the "Form" sheet and compared with a cell in the "Formdata" sheet. If the cells are different then a MsgBox is displayed with a warning and the cell is deleted...
  3. R

    Naming a Range read Name from String Variable

    Hi people! I'm fairly new to VBA and I'll appreciate your help on this. I have an argument in which I'm defining a named range, the argument is as follows: ActiveSheet.Names.Add Name:="JanMax", RefersTo:=ActiveSheet.Range(max) In this line, I'm creating a range with the name "JanMax" and it...
  4. M

    Select file, assign to variable, use in vlookup

    Hi I've been on another thread where I asked if it was possible for a user to run a macro that asks them to select a file on the hd to open. I was given the below code. It works well for selecting/opening another file, but what I would really love for it to do would be to assign the file name...
  5. A

    Referencing a sheet with a variable of type string in a macro

    I'm writing a function that gets data from a worksheet with a name dependant of the value of a cell. The cells value (e.g. Sheet1) is called into the function as string_name. Essentially I want to transform this code xrange = Sheets("Sheet1").Range("I2:I20").Value into something like this...
  6. KG Old Wolf

    .FormulaR1C1 with variable

    Goal: use "If" formula in R1C1 to evaluate cell contents; if "true" use Variable, if "false" use Constant Issue: Constant works fine in all code snippets. Variable works fine when a number (Work_2) but FAILS when text (Work_1). Following are 3 different approaches I've tried to no avail. I've...

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