+ Reply to Thread
Results 1 to 9 of 9

Select Cell using a Letter from another sheet as the column to choose

  1. #1
    Registered User
    Join Date
    01-27-2016
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    6

    Select Cell using a Letter from another sheet as the column to choose

    Hello,

    I have a file where the cell I want to select changes e.g. sometimes its F or E or G etc but the row always stays the same. The column to select is always refereced in another sheet in the same cell. I was trying to use replace but I am failing miserably. I then want to have "1" entered select the cell to the right and have that as +1 and then auto fill to the end.

    Basically I need to number the columns to use for Vlookups.

    If someone could help it would be amazing..

    Thanks


    Sub numbering()
    Sheets("Allocation").Select
    Replace (Range("F3"), "F", Sheets("Index").Range("W59").Select)
    ActiveCell.FormulaR1C1 = "=1"
    ActiveCell.Offset(, 1).Select
    ActiveCell.FormulaR1C1 = "=RC[-1]+1"
    ActiveCell.Select
    Selection.AutoFill Destination:=Range("ActiveCell:CU3"), Type:=xlFillDefault
    End Sub

  2. #2
    Valued Forum Contributor
    Join Date
    05-14-2012
    Location
    Unknown
    MS-Off Ver
    Unseen
    Posts
    429

    Re: Select Cell using a Letter from another sheet as the column to choose

    Suggest you post a sample workbook with some typical data.

  3. #3
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,540

    Re: Select Cell using a Letter from another sheet as the column to choose

    I have a file where the cell I want to select changes
    Which sheet and which row?

    The column to select is always referenced in another sheet in the same cell
    Sheet name and cell address?

    I was trying to use replace
    Replace what in which sheet in what range?

    I then want to have "1" entered
    In which cell and in which sheet?

    auto fill to the end
    It looks like to the right in your code. What determines the end?

    BTW, Selecting should be sparingly used if at all.
    Explain what you want to do and I am sure someone will come up with an understandable code (without selecting)

    If Sheets("Sheet2") Cell C5 has the letter "K" (without quotations marks) in it

    Please Login or Register  to view this content.
    Will select Cell K6 in your active sheet.

    Like InvisibleMan suggested, attach your workbook, without personal data, with before and after.

  4. #4
    Registered User
    Join Date
    01-27-2016
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    6

    Re: Select Cell using a Letter from another sheet as the column to choose

    I can't seem to add an attachement.

    In the below it is the numbers i am trying to put in. So in one case I would be using column D and entering 1 all the way accross to DZ and in the other column B and entering 1 all the way accross to DZ . The column letter to use in each case is in the sheet "Index" so it changes depending on the inforamtion.

    If i was to do it if the first situation using select it would just be as below, but the starting column changes so i dont know how to make it change based on the column letter noted in the "Index"

    'For FA Column Numbering
    Sub FAnumbering()
    Sheets("FA Allocation").Select
    Range("D3").Select
    ActiveCell.FormulaR1C1 = "=1"
    Range("E3").Select
    ActiveCell.FormulaR1C1 = "=RC[-1]+1"
    Range("E3").Select
    Selection.AutoFill Destination:=Range("E3:DZ3"), Type:=xlFillDefault
    Range("E3:DZ3").Select
    End Sub

    Situation 1
    Column A B C D E F G
    1 2 3 4
    DE red Green Blue

    Situation 2
    Column A B C D E
    1 2 3 4
    DE red Green Blue


    I am very grateful for your patience and apologies for my bad explanation.
    Last edited by MariaD89; 09-23-2016 at 10:58 AM.

  5. #5
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,540

    Re: Select Cell using a Letter from another sheet as the column to choose

    We have to start somewhere.
    Let us know if this is part of the solution.
    If it is, let us know what you want next.

    This assumes that the Column letter is in Cell A1 in a sheet named "Index"
    Change as required.
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    01-27-2016
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    6

    Re: Select Cell using a Letter from another sheet as the column to choose

    Oh my god I am very excited! yes that is what I am doing! Now is says 1 all the way across but I need it to say 1 then next one is 2 and next 3 etc.

    I don't know how you figured out my horrible explanation. I have a presentation in 2 hours so really appreciate this!

  7. #7
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,540

    Re: Select Cell using a Letter from another sheet as the column to choose

    See if this works.

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,540

    Re: Select Cell using a Letter from another sheet as the column to choose

    Here is another possibility without autofill.
    Please Login or Register  to view this content.
    Last edited by jolivanes; 09-23-2016 at 02:49 PM. Reason: fix spelling mistake

  9. #9
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,540

    Re: Select Cell using a Letter from another sheet as the column to choose

    Or, if you want to
    Please Login or Register  to view this content.

+ 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. [SOLVED] Keyboard shortcut to select column by the column letter
    By Megatronixs in forum Excel General
    Replies: 10
    Last Post: 07-24-2014, 04:29 AM
  2. [SOLVED] Using a letter in one cell to reference to a column in the sheet
    By SEANLIPINSKI in forum Excel General
    Replies: 5
    Last Post: 06-23-2014, 02:41 PM
  3. Replies: 10
    Last Post: 01-17-2013, 01:42 PM
  4. Replies: 2
    Last Post: 03-09-2011, 12:18 PM
  5. Replies: 10
    Last Post: 07-12-2010, 08:55 AM
  6. Replies: 2
    Last Post: 02-04-2005, 11:06 PM
  7. [SOLVED] From VBA: How to select a column by column number instead of letter?
    By (Pete Cresswell) in forum Excel General
    Replies: 3
    Last Post: 02-04-2005, 06:07 PM

Tags for this Thread

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