+ Reply to Thread
Results 1 to 8 of 8

Use Vlookup as macro on clicked cell and all cell values below that clicked cell

  1. #1
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Use Vlookup as macro on clicked cell and all cell values below that clicked cell

    Respected Experts ...kindly help me on creating this macro

    Use Vlookup as macro on clicked cell and all cell values below that clicked cell

    Tab copied sheet is my sample data on which I want a macro to be created.
    Tab Final result as represent the final data which should look like

    1) Wherever I click on Tab copied sheet, macro should run and use vlookup as function to tally data with tab Designation and fill all the cell value on and below of that click cell. Example in this case if I click E2, value of E2 till E nth value should change.

    2) Data value which it cannot find in Designation tab should not return #na value and the cell value should remain as it is.


    **I want this on click function because my column header name for designation can vary from file to file which I receive,also sometimes column headers are in unsorted waydue to which it will be great if vlookup gets applied on click function Format issue resolved.xlsm

  2. #2
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Use Vlookup as macro on clicked cell and all cell values below that clicked cell

    Any help on this one friends...

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Use Vlookup as macro on clicked cell and all cell values below that clicked cell

    Hello harman83,

    This macro worked on your data.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Use Vlookup as macro on clicked cell and all cell values below that clicked cell

    Awesome..awesome....awesome Leith....Thanks for helping me out...

  5. #5
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Use Vlookup as macro on clicked cell and all cell values below that clicked cell

    Hi

    Kindly help me out to find the issue .

    I am using the same code which you coded for Designation. Now I want to use same code for different columns like using lookup for JOb Function.

    In the code you gave I make changes on 1) Set Wks = Worksheets("Job Function") and 2) Sub UpdateJobFunction() rest everything is same. but this macro is not working for me. Kindly suggest what am I missing.


    Sub UpdateJobFunction()

    Dim Cell As Range
    Dim Dict As Object
    Dim Key As String
    Dim Item As Variant
    Dim Rng As Range
    Dim Wks As Worksheet

    Set Dict = CreateObject("Scripting.Dictionary")
    Dict.CompareMode = vbTextCompare

    Set Wks = Worksheets("Job Function")

    Set Rng = Wks.Range("A1").CurrentRegion
    Set Rng = Intersect(Rng, Rng.Offset(1, 0))

    For Each Cell In Rng.Columns(1).Cells
    Key = Trim(Cell)
    Item = Cell.Offset(0, 1)
    If Key <> "" Then
    If Not Dict.exists(Key) Then Dict.Add Key, Item
    End If
    Next Cell

    Set Wks = Worksheets("Copied Sheet")

    Set Rng = Wks.Range("A1").CurrentRegion
    Set Rng = Intersect(Rng, Rng.Offset(1, 0).Columns(5))

    For Each Cell In Rng
    Key = Trim(Cell)
    If Dict.exists(Key) Then Cell = Dict(Key)
    Next Cell

    End Sub

  6. #6
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Use Vlookup as macro on clicked cell and all cell values below that clicked cell

    Am I doing something wrong over here?Kindly suggest.

  7. #7
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Use Vlookup as macro on clicked cell and all cell values below that clicked cell

    Strange initially the code was working...Now code is not working...
    Set Rng = Intersect(Rng, Rng.Offset(1, 0).Columns(5))
    In thiscode initially I changed...Columns(5) to Columns(9)...and since then it is not working..Kindly suggest.Vlookup column.xlsm

  8. #8
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Use Vlookup as macro on clicked cell and all cell values below that clicked cell

    Issue resolved.....Thanks for the help experts....

+ 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. Replies: 4
    Last Post: 09-26-2015, 06:44 PM
  2. [SOLVED] Load web image when cell holding URL is clicked/double-clicked
    By jchamber00 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-20-2013, 09:13 PM
  3. [SOLVED] code so that when a cell is clicked, a tick mark goes in the cell that was clicked
    By behnam in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-08-2013, 01:17 PM
  4. Run a macro when a cell is clicked
    By souvick in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-17-2011, 01:50 PM
  5. Run macro when cell is clicked but NOT selected
    By Alicita in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-31-2011, 08:44 AM
  6. Run macro when a cell is clicked
    By Macdave_19 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-20-2010, 08:33 AM
  7. Change cell value when right-clicked/double-clicked
    By grime in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-17-2005, 09:05 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