+ Reply to Thread
Results 1 to 3 of 3

Using the contents of a range

  1. #1
    Registered User
    Join Date
    06-27-2011
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    2

    Using the contents of a range

    Hi Guys,

    As you will see from the following question - I am definitely a new user to vba.

    I want to search a table for a string and for the first occurence found I want to be able to use the data in the cell three cells to right. Eg if A1 = "eggplant" and A3 = "cook with salt" I want to be able to search for "eggplant" and return in a msgbox "cook with salt".

    Could someone kindly give me a few tips.

    Thanks in advance
    Gary

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Using the contents of a range

    Why would you need VBA for this? A simple VLOOKUP formula would work
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    06-27-2011
    Location
    Australia
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Using the contents of a range

    Quote Originally Posted by royUK View Post
    Why would you need VBA for this? A simple VLOOKUP formula would work
    Because actually, I guess I was trying to simplify what I was trying to do. My goal is actually to produce a form of sorts where you put in a student number then format the number. A macro then searches various sheets for the student number and consolidates formatted search results into either a couple of cells at the top of a table or into a form.

    I thought that my first step would be to be able to use find (or application.vlookup) on a string get the resultant range and use the data in the row for each cell in the range.

    So if I have a table where;

    A1 = "112233" and B1 = "English"

    Please Login or Register  to view this content.
    output would be a range with the first cell in that range referencing A1, how do I assign to a string variable the value of the column beside A1 (ie B1)?

    Thanks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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