+ Reply to Thread
Results 1 to 4 of 4

vba excel calling an array within a Find function

  1. #1
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    vba excel calling an array within a Find function

    I have:
    Please Login or Register  to view this content.
    I create my array within another routine which prints correctly, however, I get a type mismatch error thrown when I call the array value within a Find function as a string value. I usually don't have problems trying to find a string values this way, but for some reason using the array value bombs it. What am I doing wrong here?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: vba excel calling an array within a Find function

    rng in your code is an array, you need to use Set.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: vba excel calling an array within a Find function

    Thanks. That seems to fix a part of it. My fStart is still Nothing when the string value exists within rng.

  4. #4
    Forum Contributor
    Join Date
    02-25-2013
    Location
    Colorado, US
    MS-Off Ver
    Microsoft 365 Apps
    Posts
    518

    Re: vba excel calling an array within a Find function

    I seemed to have solved my own question. I just needed to ensure I was using apples to apples. I was searching for a date however the variable was declared as a string. Using the CDate function solved the problem by converting the string to a date value. The original value (within A:A) was delimited from a string; however, when looking at the previous routine that parses the string, range B:B was defined as "mm/dd/yy;@" (range C:C was defined as "h:mm:ss;@"). I tried using DateValue(string) but that did not work because the string value had not been converted to date and DateValue() assumes there is h:mm:ss within the date string.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Calling a Function ( array ) in a Sub
    By Najwa_X in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-16-2020, 08:42 AM
  2. [SOLVED] Calling elements from an array from another sub
    By realdemigod in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2016, 04:20 AM
  3. Calling Sub from Array!
    By sianjialin in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-06-2014, 06:17 AM
  4. [SOLVED] calling nth element in an array to be used in another code
    By vick2075 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-04-2013, 10:48 AM
  5. Replies: 1
    Last Post: 04-19-2012, 04:37 AM
  6. Replies: 1
    Last Post: 02-10-2012, 05:27 PM
  7. calling/using an array
    By Hein in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2009, 07:13 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1