+ Reply to Thread
Results 1 to 18 of 18

Cell Reference using cells(i, range)

  1. #1
    Registered User
    Join Date
    11-02-2014
    Location
    Marbella, Spain
    MS-Off Ver
    Excel Mac 2016
    Posts
    77

    Cell Reference using cells(i, range)

    Hello all,

    on the following Macro:


    Please Login or Register  to view this content.
    , I know that the command

    Please Login or Register  to view this content.
    , it's wrong.

    because if I put a reference column in number as 16, the Macro Works fine.
    Please could you tell me how designate that?

    And if I want to look for not in one single column but 5 or more or less, how could I do it?

    Thank you so much.
    Last edited by coolx72; 09-24-2018 at 09:02 AM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,612

    Re: Cell Reference using cells(i, range)

    code tags ok...
    Last edited by protonLeah; 09-24-2018 at 03:04 PM.
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    11-02-2014
    Location
    Marbella, Spain
    MS-Off Ver
    Excel Mac 2016
    Posts
    77

    Re: Cell Reference using cells(i, range)

    I have corrected that.

    I'm sorry for any inconvenient.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Cell Reference using cells(i, range)

    Assuming that cell contains a column number or letter, use:

    Please Login or Register  to view this content.
    Rory

  5. #5
    Registered User
    Join Date
    11-02-2014
    Location
    Marbella, Spain
    MS-Off Ver
    Excel Mac 2016
    Posts
    77

    Re: Cell Reference using cells(i, range)

    Thank you Rorya,
    I've tried that but it comes out with an error. Maybe is it because I`m using Mac?

    Thank you very much

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Cell Reference using cells(i, range)

    No, that should work on a Mac. What exactly is in cell AV1 on the active sheet?

  7. #7
    Registered User
    Join Date
    11-02-2014
    Location
    Marbella, Spain
    MS-Off Ver
    Excel Mac 2016
    Posts
    77

    Re: Cell Reference using cells(i, range)

    16 that would be correspondent on column 16 (P)

    But besides this if I would like to look in more columns would be possible?

    Thanks

  8. #8
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Cell Reference using cells(i, range)

    I suspect the wrong sheet is active when the code runs. Which sheet has the 16 in cell AV1?

  9. #9
    Registered User
    Join Date
    11-02-2014
    Location
    Marbella, Spain
    MS-Off Ver
    Excel Mac 2016
    Posts
    77

    Re: Cell Reference using cells(i, range)

    Maybe because does not make much sense that error.

    "Jugs Tarjs Acum" is where is to look for the information

    "Impedidos" is the output table that works fine if I put 16 corresponding to (P).

    Each time I want to check the players that can not play the next round, I have to edit the macro and change to 17, 18 etc.

    thank you once again

  10. #10
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Cell Reference using cells(i, range)

    I'd suggest you specify that sheet then. Try this:

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    11-02-2014
    Location
    Marbella, Spain
    MS-Off Ver
    Excel Mac 2016
    Posts
    77

    Re: Cell Reference using cells(i, range)

    Hello again Rorya,

    You are the Man. Thank you so much !!!

    I would like to ask you 2 more things please:
    1- On previous solution, I copy first all to maintain formats then values to avoid circular and maintain the values of the source table. On your project what should I change?

    2- If I want to have the possibility to see which players had cards from round 4-10, this would correspond (16-22)
    My solution, for sure not yours, I would repeat at least ten times the macro changing (AV1-BE1) and then. Other easy way?

    3- On the file there is other VAB on Duplicados sheet, when I execute happens the same that I solved before but with this code I don't know what to put that would be after paste all, paste values to not have circular and also to maintain initial table values.

    And thank you once again for your time. It is fantastic

    BR,
    Pedro
    Attached Files Attached Files

  12. #12
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Cell Reference using cells(i, range)

    For #1:

    Please Login or Register  to view this content.
    For #2, change the code to take the column number as an argument, then call it from separate routines:

    Please Login or Register  to view this content.
    which you'd then call like this:

    Please Login or Register  to view this content.
    or in a loop.

    For #3, I think you just need to change this:

    Please Login or Register  to view this content.
    to this:

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    11-02-2014
    Location
    Marbella, Spain
    MS-Off Ver
    Excel Mac 2016
    Posts
    77

    Re: Cell Reference using cells(i, range)

    Thank you Thank you Thank you

    About your message:

    For #1:

    IT`S SOLVED !!! THANK YOU. Just a request If I have a column to put the round number that is on line 1 from 16-20 column, when it send to "impedidos", is there some option to put the value of each column on line one of "Jugs Tarjs Acum" ? Thank you and pardon for one more request.


    For #2:
    Does not recognize the name of Macro: Sub Impedidos(vColumn)
    I change it for: Sub Impedidos(vColumn), and does not work either or I wrote it wrong.

    Atached is the actual solution.


    For #3:
    Works very well but does not have the format


    Thank you and I'm sorry for bother you again
    Attached Files Attached Files
    Last edited by coolx72; 09-24-2018 at 12:04 PM.

  14. #14
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Cell Reference using cells(i, range)

    I'm afraid I'm not clear what you mean for #1. Can you give a specific example of what you want to put where?

    Re #2, you need to create other macros that call the Impedidos routine and pass the required values to it, as I showed.

    For #3, use this:

    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    11-02-2014
    Location
    Marbella, Spain
    MS-Off Ver
    Excel Mac 2016
    Posts
    77

    Re: Cell Reference using cells(i, range)

    Hello Rory and thanks for everything time and knowledge once more.

    About the #1, Please forget it, any way, I found a solution with lookup, based on cel AV1

    Nš INSCR TEAM INSCR TEAM Nombre. DNI FECHA DNI ROUND
    3 Team A 3 Luis Figo 983425794 12-04-1995 1
    6 Team B 6 Leonel Messi 698746508 18-01-1994 1


    Regarding the #2, I don't want you to do my work, but I don't have a clue how to do it.

    Concerning the #3 works, however it ask me to confirm for all registers. If I have 1 line ok, If I have more it would be more easy do automatic acceptance.

    Thank you once again

  16. #16
    Registered User
    Join Date
    11-02-2014
    Location
    Marbella, Spain
    MS-Off Ver
    Excel Mac 2016
    Posts
    77

    Re: Cell Reference using cells(i, range)

    Hello again Rory #3 Solved
    I added this command: I don't know if it is dangerous:

    Please Login or Register  to view this content.
    So the macro final result it would be this one:

    Please Login or Register  to view this content.
    SO please if you could help me with #2 everything would be solved.

    Thank you once again

  17. #17
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,913

    Re: Cell Reference using cells(i, range)

    I already showed how to do #2, and gave a couple of example lines. You create another macro that calls the first one passing the required column; you can’t run the first macro directly as it now needs an argument passed.

  18. #18
    Registered User
    Join Date
    11-02-2014
    Location
    Marbella, Spain
    MS-Off Ver
    Excel Mac 2016
    Posts
    77

    Re: Cell Reference using cells(i, range)

    Hello Rory,

    Thank you once again.

    At the end with a filter column I got the result.

    But I would like to understand your solution.

    Thank you once again

+ 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. Create a named range of cells BUT variable in reference to a cell value
    By peponfree in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 02-13-2014, 12:46 PM
  2. [SOLVED] Using the value in a cell to reference the range of cells to use in a formula
    By dannybten23 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-07-2014, 09:26 AM
  3. Dividing a range of cells by a reference cell
    By hooman_teh in forum Excel General
    Replies: 4
    Last Post: 08-04-2010, 09:48 AM
  4. Finding a particular cell reference among a range of cells
    By deathbybowtie in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-12-2009, 04:42 AM
  5. Fastest way to reference a cell - Range() or Cells() ?
    By StephanieD in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-29-2008, 01:19 AM
  6. Replies: 1
    Last Post: 11-19-2008, 08:35 PM
  7. How do I reference the same cell as I move through range of cells.
    By MikeShep in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-07-2005, 09:34 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