variant

  1. L

    variant data type

    Hi I am trying to under variant data type and here it says: "The Variant data type is capable of holding any type of data except fixed-length strings and user defined types." what does "fixed-length" mean here? I tried this code and it works fine Sub testing() For i = 1 To 10 j = "hello"...
  2. M

    VBA/Macro for saving a range into an array (variant) and use this for defining data for a graph

    Hey forum I am trying to do many things in my program for analysing a dataset. However I have run into some kind of wall. I will need help from you guys. I started of making a lot of code where I have hard coded some ranges into the program. These ranges tells the program where it should find...
  3. T

    Remove duplicates, return multiple columns

    This code will remove duplicates from column A, so if my data was: a a b c d it will return: a b c d Here is the code: Dim DIC As Object Set DIC = CreateObject("Scripting.Dictionary") Dim MyArray() As Variant MyArray() = Sheet1.Cells(1...
  4. K

    VBA - save Array to use after close

    Hi, I am a basic user of arrays. I build a 2d array "IDarr" ReDim IDarr(1 To r, 1 To 3) As Variant 'Column 1 is Project task Name with unique ID IDarr(r, 1) = ThisProject.Name & "_" & iTask.UniqueID 'Column 2 is Outlook Calendar ID IDarr(r, 2)...
  5. V

    Set Array Name in a Cell and Reference in Code

    Good day all. I'm using the code below to be able to create a pdf from multiple worksheets with different print areas as one file. The issue I have is that the array which determines which sheets to print as well as the print areas are different each time. It will be fairly easy for me to...
  6. R

    VBA to variant returns string through iteration

    Hello guys, i am beating my head here need your help... i have 2 strings and i want a variant to call this string through an iteration, but i can't get it. Sub teste() Dim i As Integer For i = 1 To 2 var1 = "Empresa" var2 = "Material" desc = "var" & i l = Application.Match(desc...
  7. S

    User Defined Function Error "subscript out of range"

    I am writing a UDF to return array variants given the UDF subscript values. The UDF is below: Function LogPriceData(Arr As Variant, numberObs As Integer) As Variant Dim yy As Integer Dim Array1() As Variant: ReDim Array1(1 To numberObs) Dim Array2() As Variant: ReDim Array2(1 To...
  8. S

    Array built from array and declaration trouble

    I would like to populate the array TempSample using PriceData. PriceData is currently defined using a worksheet table. How can I convert the current PriceData variant into something that will behave like a traditional array? If I ReDim PriceData(1 to A, 1 to 3) as Variant, where A is equal to...
  9. S

    Type Mismatch

    I am working with a User Defined Function to transform an array of nominal integer values to logarithms. I have the code below. LogArray is a variant and I suspect this data type does not work with the integer values being fed into the worksheetfunction. How can I build the array to hold log...
  10. C

    Dictionary, item, object required error

    I am getting an object required error when I run the following code: Sub Schedule15(theDictionary As Dictionary) Dim singleKey As Variant For Each singleKey In theDictionary.Keys() Debug.Print theDictionary.Item(singleKey).Country Next singleKey...
  11. N

    Help to open file when match HDD serialnumber

    Hi all I have excel file that a little computer can open it, according to HDD serialnumber (C:\) Code belove can't run, please fix it. I'm not good at VBA code Thanks./. Private Sub Workbook_Open()Dim oFSO As Object, drive As Variant, driveC As Variant Set oFSO =...
  12. B

    hiding rows based on cell content (multiple options)

    If presently have the following coding and it works for this specific case but I need to add other options as well Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$C$37" Then Dim arCases As Variant Dim res As Variant arCases = Array("Term", "Indeterminate"...
  13. J

    How to pass an Array to a Chart using VBA

    I have a Chart with 10 Series. For one of the series (Series 9) I want to pass the values using an array. I have created a SUB but I am unable to execute it, and can't figure out the reason. There are two charts in the Sheet. Chart1 and Chart2. I want to pass values to Chart1. Error that I am...
  14. S

    Runtime Error Overflow

    Greetings, I am receiving an Overflow error on the following line: centroids(ii, bb) = centroids(ii, bb) / counter The line is within the script below: Public Function ComputeCentroids(X As Variant, idx As Variant, K As Variant) As Variant...
  15. D

    Help with Type mismatch in dictionary

    Hello board, i am hoping someone can help me. I have reused something i picked up a long time ago for a new purpose but i cant seem to get it to work. Sub Calculate_Period_Headcount() Dim ws As Worksheet Dim i As Long Dim EndRow As Long Dim arr1 As Variant ' Column A UIN...
  16. Eric W

    Combining 4 letters from column A and 4 letters from column B

    I'm opening this thread on behalf of Danya Subramanian who sent me a PM: First, Danya, if you see this, it's preferred that you open a new thread if you have a new question. That way others can benefit from seeing the answer. Also, you can't receive PMs until you have a certain number of...
  17. O

    Transfer Cells Based on Header

    I am new to VBA and have hit a bit of a brick wall with my latest challenge. I have a report that gets generated based on the attributes of a block in Autocad. I need to take that information and transfer it to a spread sheet that is used by another department. Needless to say I am not allowed...
  18. T

    Using Collection instead of Array

    This code removes all rows if column E contains Oranges Dim DataArray() As Variant DataArray() = Sheet1.Cells(1, 1).CurrentRegion.Value Dim DataArrayRows As Long DataArrayRows = UBound(DataArray(), 1) Dim DataArrayCols As Long DataArrayCols =...
  19. L

    Bold is Variant not Boolean

    Hi Excel define Bold as a variant. Yet the example below (from https://docs.microsoft.com/en-us/office/vba/api/excel.font.bold) Assigned True to Bold!! So why excel did not define Bold as a Boolean? It would make sense to be define as Boolean. Thank you. what does it mean a variant variable...
  20. G

    Subtracting an array from another array?

    Hi Is there a way to subtract an array of string from another array of string? I have a larger array and what I need is an array which is the result of the larger array minus the other array. Function HideUnwantedElements(MainArray As Variant) Dim ToBeFilteredOut As Variant Dim...

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