Results 1 to 2 of 2

Thread: Q: VBA - using a range of strings as an argument

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    1
    Rep Power
    0

    Post Q: VBA - using a range of strings as an argument

    Dear all,

    I am new to this forum and decided to pose you a question that drives me nuts.

    I want to create a function that has 2 arguments:
    1. A single cell that contains a string = Role
    2. A range of cells containing strings = RangeR


    I compare the content of Role to the content of each of the cells in RangeR.

    As an example code I then return the value of the second comparison.

    Could some check what I did wrong in my code?:

    Code:
    Function getresponsible(Role As String, RangeR As Range)
    
    Dim MatchingArray(1 To 5) As Boolean
    Dim dum As Boolean
    
    For i = 1 To 5
        dum = Application.WorksheetFunction.Search(Role, RangeR(1, i))
        MatchingArray(i) = Application.WorksheetFunction.IsNumber(dum)
    Next i
    
    getresponsible = MatchingArray(2)
    
    End Function
    https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA
    Last edited by DocAElstein; 10-02-2023 at 12:45 PM.

  2. #2
    Member
    Join Date
    Jun 2013
    Posts
    93
    Rep Power
    12
    can you attach a sample file and explain better your goal ?

Similar Threads

  1. How Get Value From A Cell Range Using VBA
    By ajgcook1983 in forum Excel Help
    Replies: 5
    Last Post: 09-17-2013, 09:28 AM
  2. Forcing an Argument to be Passed by Value
    By Transformer in forum Tips, Tricks & Downloads (No Questions)
    Replies: 4
    Last Post: 05-21-2013, 11:28 AM
  3. VBA Looping Input Range and Output Range
    By Whitley in forum Excel Help
    Replies: 7
    Last Post: 04-25-2013, 09:02 PM
  4. Converting text strings to points
    By Rasm in forum Excel Help
    Replies: 1
    Last Post: 10-23-2011, 08:23 PM
  5. Worksheet Protection Method with UserInterfaceOnly Argument
    By technicalupload in forum Download Center
    Replies: 1
    Last Post: 09-02-2011, 04:17 PM

Posting Permissions

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