variable declaration

  1. S

    Variable Declaration General Question

    Hey everyone, So I just have a general question about variable declaration in vba. If you declare a variable in a module, can it then be used in other subs/functions in that same module without declaring it again? Can it be used in other modules without declaring it again as well? I use option...
  2. C

    Using a function in VBA across a range

    I need to pull in two values across two cells on a source document and include it on a column header on a worksheet: Workbooks(today_name).Worksheets(5).Activate date_today = Range("E3").Value file_name = Range("E1:E2").Value Workbooks(wkbk_name).Worksheets("Provision").Activate...
  3. A

    VBA Code is slow-reason ???

    Hi, I am using similar lines of codes to add more than 50 lines to the existing data. Cells(P,Application.WorksheetFunction.Match(Workbooks("Reference").Sheets("Carrierlist").Range("A"& i) "ARC", Rows(1), 0)) Result is my code becomes slow. Would assiging this code a variable solve my...
  4. J

    "variable not defined" error with "sub" highlighted

    Hi all, I have a loop code as per below, which works fine in the original spreadsheet for which it was written. Although the row containing "Sub Matrix2DB()" is highlighted yellow. BUT when copying to a new spreadsheet, with all of the sheets, columns and rows set out as required in the macro...
  5. R

    Filtering and declaration

    Hi All, I have declared the below Dim Fltr As String Dim Component As Integer Fltr1 = "USA" Fltr2 = "Ireland" Fltr3 = "Australia" and I am trying to loop in by using the above for the filter shown below. Selection.AutoFilter ActiveSheet.Range("$A:$U").AutoFilter Field:=2...
  6. R

    Trying to put a variable in a URL to be Hyperlinked. Help please

    So I'm trying to put a variable into a URL that is going to be hyperlinked. if i do a " & Folder1 & " then it simply leaves it out and merges the URL without inputting what is within the variable Folder1. The same goes for Plant and Manifest. What's in red is my problem. Help please. Here's...
  7. Prevost

    Error when userform textbox value is empty

    Hi, I have a userform with 2 textboxes that a user can enter values in. When I step through the code, WOQty is "0" and WONo is "" even when the textboxes have values entered into them. I declared 'Public WOQty as Integer' and 'Public WONo as String' in my UserForm and then tried in a Module and...
  8. L

    VBA Code help - Copy Title as Variable then paste else where

    Good morning, I am trying to hone my VBA skills, but I can't seem to wrap my head around this key concept. I would like to save the contents of a cell (It's a title) as a variable in a form of a string, then copy its contents into another cell. Here is what the code I have put together...
  9. J

    Declare and set project variables for worksheets and dynamic ranges

    Hi I am trying to declare and set worksheet and dynamic range variables globally. I have several worksheets and forms in a workbook and I have found it difficult to keep track of where all my variables are stored so that when I make any amendments to the location of the worksheet or range, they...

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
Back
Top