+ Reply to Thread
Results 1 to 9 of 9

Set Formula With Range ("E5:" & Lastusedcol & lastusedrow) Also Column letter from Col num

  1. #1
    Valued Forum Contributor mangesh.mehendale's Avatar
    Join Date
    06-04-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    510

    Set Formula With Range ("E5:" & Lastusedcol & lastusedrow) Also Column letter from Col num

    hiii,

    What I want is below code... But GetColumnletter Not Working

    Please Login or Register  to view this content.
    Last edited by mangesh.mehendale; 09-14-2016 at 02:30 AM.
    Don`t care, take care...

    Regards,
    Mangesh

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,607

    Re: Set Formula With Range ("E5:" & Lastusedcol & lastusedrow) Also Column letter from Col

    GetColumnletter is custom function that you need also to copy in your workbook if you want it to work.
    If it can't find it then you'll get error at this point.

  3. #3
    Valued Forum Contributor mangesh.mehendale's Avatar
    Join Date
    06-04-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    510

    Re: Set Formula With Range ("E5:" & Lastusedcol & lastusedrow) Also Column letter from Col

    Okay got it.... Please let me know the way to tackle this in above code I want to define "With Range("E5:" & celletr & Lastcol)" ...
    let me know the code for celletr

  4. #4
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Set Formula With Range ("E5:" & Lastusedcol & lastusedrow) Also Column letter from Col

    here is what microsoft suggests
    Please Login or Register  to view this content.
    https://support.microsoft.com/en-gb/kb/833402
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Set Formula With Range ("E5:" & Lastusedcol & lastusedrow) Also Column letter from Col

    Hi,

    There is no necessity to convert the column number if you use the Cells property

    Please Login or Register  to view this content.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  6. #6
    Valued Forum Contributor mangesh.mehendale's Avatar
    Join Date
    06-04-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    510

    Re: Set Formula With Range ("E5:" & Lastusedcol & lastusedrow) Also Column letter from Col

    hii Thanks for suggesting Cell Property but Somthing is wrong... it is pasting formulae till Col TL even though there is data till Col UR
    Last edited by mangesh.mehendale; 09-23-2016 at 02:39 AM.

  7. #7
    Valued Forum Contributor mangesh.mehendale's Avatar
    Join Date
    06-04-2015
    Location
    India
    MS-Off Ver
    2007
    Posts
    510

    Re: Set Formula With Range ("E5:" & Lastusedcol & lastusedrow) Also Column letter from Col

    but Working correctly after below modification...
    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    11-15-2010
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2003
    Posts
    538

    Re: Set Formula With Range ("E5:" & Lastusedcol & lastusedrow) Also Column letter from Col

    In case useful, very compact and (reportedly) CPU efficient column letter methods:

    VBA, for range rng:
    Mid(rng.Address,2,InStr(2,rng.Address,"$")-2)

    Not asked, but for completeness, for regular Excel for cell C2:
    =char(64+column(C2))

    That is tempting because it's so very compact, but Excel master Aladin Akyurek much preferred the following, and at the time clocked it as fastest of several choices, so I now only use this for regular Excel:

    =SUBSTITUTE(ADDRESS(1,COLUMN(C2),4),"1","")
    for cell C2 on current sheet. Substitute {D5} for {C2} to get a different cell like D5

    Substitute {anysheet!D5} for {C2} to get D5 from another sheet. (I know that seems silly on the surface if you think about it )
    Chip, if you can read this, you're STILL making the world a better place with your immeasurably valuable gifts. Every week, you continue to help me (and untold numbers of others) tremendously. Practically no alternative outlets can match your effectiveness, even over the vast number of topics you demystify and empower usage of. You were, and still are, amazing.

  9. #9
    Forum Expert Doc.AElstein's Avatar
    Join Date
    05-23-2014
    Location
    '_- Germany >Outside Building things.... Mostly
    MS-Off Ver
    Office 2003 2007 2010 PC but Not mac. XP and Vista mostly, sometimes Win 7
    Posts
    3,618

    Re: Set Formula With Range ("E5:" & Lastusedcol & lastusedrow) Also Column letter from Col

    Here allso a collection of some ways to get the Column Letter from a Column Number

    http://www.excelforum.com/tips-and-t...explained.html
    '_- Google first, like this _ site:ExcelForum.com Gamut
    Use Code Tags: Highlight code; click on the # icon above,
    Post screenshots COPYABLE to a Spredsheet; NOT IMAGES PLEASE
    http://www.excelforum.com/the-water-...ml#post4109080
    https://app.box.com/s/gjpa8mk8ko4vkwcke3ig2w8z2wkfvrtv
    http://excelmatters.com/excel-forums/ ( Scrolll down to bottom )

+ 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] Tweak Code "change the column number to column letter" in Macro
    By capson in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-22-2013, 10:44 AM
  2. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  3. Replies: 3
    Last Post: 04-14-2013, 11:53 PM
  4. [SOLVED] Formula needed to display "Pass" or "Fail" if a column contains any values other than "yes
    By andreindy in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-26-2013, 05:49 PM
  5. Replies: 5
    Last Post: 07-05-2012, 04:04 PM
  6. Replies: 8
    Last Post: 07-05-2012, 03:07 PM
  7. Changing first letter to caps, letters after "-" and "/", and rest to small letter.
    By rhexis07 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-17-2008, 08:03 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