Consulting

Results 1 to 3 of 3

Thread: Learning VBA Variables

  1. #1

    Learning VBA Variables

    Hi Guys,

    I was wondering if anyone can help me I was wondering how I would set up a variable that would determine the amount of cells to check for in a range depending on the value entered into a Cell

    So if Value X Was entered into Cell A1 it would Check For 2 occurrences of A Value
    And If Value Y Was entered Into Cell A1 It would Check For 1 occurence of The Same Value?

    I appologise if this is vague but am trying to learn how to implement new variables into a subroutine and am really struggling.

    many thanks

    jamie

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Can you attach a small example workbook?
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Expert
    Joined
    May 2016
    Posts
    604
    Location
    Your question is ambiguous, you state:
    "determine the amount of cells to check for in a range"

    Later you state:
    "Check For 2 occurrences of A Value "

    Are you wanting to set up a variable to change the size of a range?

    or are you trying to set up a variable to check for the number of occurences of a search?


    or both? In which case you will need two variables

Tags for this Thread

Posting Permissions

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