+ Reply to Thread
Results 1 to 8 of 8

The Great Debate: Tabs or spaces?

  1. #1
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    The Great Debate: Tabs or spaces?

    I'm a tab man. I share the view of that fella on 'Silicon Valley', devs who uses spaces should be taken out and shot to save time.

    However......

    https://www.theregister.co.uk/2017/0...paces_vs_tabs/

    Even more of a reason to dislike devs who use spaces over tabs. :-/

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: The Great Debate: Tabs or spaces?

    Tabs are great for lining up: For....Next, If....End If, Do...Loop etc but spaces here and there can pretty-up the code
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Expert
    Join Date
    04-01-2013
    Location
    East Auckland
    MS-Off Ver
    Excel 365
    Posts
    1,343

    Re: The Great Debate: Tabs or spaces?

    But if you can't confuse the next coder with your odd personalized usage of tabs and spaces how are you going to confuse them enough to convince the boss with your coding skills are irreplaceable and worth a pay-rise?
    If you want something done right... find a forum and ask an online expert.

    Time flies like an arrow. Fruit flies like a banana.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: The Great Debate: Tabs or spaces?

    Parabolic, Hyperbolic, Elliptic? They're all beautiful

  5. #5
    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

    Tab Slabs and similar inconsistant stuff...

    Hi
    I think indenting is very helpful. I think up until now I have only seen one professional that does not always use them .. ( – that Indian Guy, Dinesh Kumar Takyar https://www.youtube.com/watch?v=JgZA...em-subs_digest )

    The convenience of hitting the Tab key one or more times to achieve the required indent I find/ found very convenient.
    But, I think it is one of these things like carriage returns and line feeds. Sometimes there are inconsistencies in different situations and systems in how they are defined, used and / or interpreted.
    Recently when learning about reading data from / to different things I saw a lot of inconsistencies in carriage returns and line feeds and combinations there of. You see similar inconsistencies sometimes when simply copying and pasting text into/from different systems, - you can get for example either extra lines, or your text of multiple lines may come out as a continuous single line.

    I expect you can run into similar inconsistencies in how Tabs are interpreted.
    I guess it is the inconsistency in how many spaces a Tab might “look like” that bugs me**.

    So I personally, am tending to go for spaces as I know then at least what I have.. maybe..
    **I tend to run text / data that I have sometimes through a code that checks what it actually has in it in terms of carriage returns and line feeds, ( https://www.excelforum.com/developme...ml#post4664188 ). It would probably be a good idea for me to extend that to check for the presence a Tab as well.

    _._________

    I would find it useful if you could use the “empty spaces” you use for indents so as to help keep track in a large code of the different sections, like somehow being able to include ‘comments not only at the end of a code line…..

    Please Login or Register  to view this content.
    Alan



    P.s.’s
    _ It remains a pain in the bum , in my opinion, that Forum Editors typically eat __ spaces _____ .. of more than one in text.
    Tabs don’t appear to work either.
    _ Interestingly, I have seen bugs in Forum Editors whereby those ‘ii’’s , ‘wivwon’’s and ‘jjjj’’s of mine do actually appear in the form of ****’s in a code window. … Strange.
    _.....
    _ What is a Tab?? – A Slab … of nothing … or spaces … or s p a c e s of a space in length ????

    I think I will call these: ‘ii’’s , ‘wivwon’’s and ‘jjjj’’s … vbSlab ‘ s





    The Ace of spaces, http://listenonrepeat.com/watch/?v=1..._Ace_Of_Spades
    Last edited by Doc.AElstein; 06-23-2017 at 06:56 AM.
    '_- 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 )

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: The Great Debate: Tabs or spaces?

    Not sure how well known this one is but I've used this VBA procedure Smart indenter Add in for many years
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  7. #7
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: The Great Debate: Tabs or spaces?

    What is a Tab?
    It's a single 'character', Chr(9).

    How it's interpreted is defined by the editor you're using.

  8. #8
    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

    Tabs or spaces and the such. All a bit messy and inconsistant. How Pooy :(

    Quote Originally Posted by Laz View Post
    It's 'character', Chr(9). - How interpreted is defined by the editor
    Thanks, Laz, - I expected it was something like that. I would imagine a Tab is a little better behaved, that is to say is not changed to a different character by different systems/ editors, as I have found is the case with Carriagereturns and Linefeeds sometimes .
    I expect you can probably adjust in some things how many “spaces” a Tab is. I could not google anything, but I think someone mentioned you can change some settings somewhere.
    I am still not too keen on using something that might look different in different systems.
    I had a quick play just now:
    In a cell, if you paste in _ vbTab & "somefink" & vbTab & "somefinkelse" _ then you just seem to see _ somefinksomefinkelse _ If you copy that and paste in word you get something like _ _somefink___somefinkel _ ( note a bit is lost at the end )
    That all seems very messy
    If I instead paste _ "___" & "somefink" & "___" & "somefinkelse" _ in a cell , then it truncates that to single spaces _ _somefink somefinkelse _ Copying that to word looks similar _ _somefink somefinkelse _
    So that is all a bit messy also.
    Also you need to be careful with the “type“ of space, - there is at least two that I know about: You have a non breaking space thingy and then the normal space character (32). You sometime need to be careful about that when using some Functions that only recognise the Char(32) as a space: https://support.office.com/en-us/art...c-9e5630b479f9 You will sometimes need to do something like this _ SUBSTITUTE("SchTxt",CHAR(32)," ") _ to get over that problem.
    So all very messy again.
    If you look into “Tab” conventions in Debug.Print, then you get something else again- you have things like Tab and Tab(x) which gives you a “position across” rather than a “gap”

    It is all quite a mess. It is a shame, in my opinion, that some developers never got their heads together and got a bit more consistency in all these things.

    _......
    _._______________________________-
    @ Richard.
    That Add in looks quite involved. I did not realise anyone used things like that. I thought most people would like just write the complete set of things that would need indenting in one go, then fill in the lines between.., like I mean one would do this first_...
    ___ If ……..

    ___ Else ……

    ___ End If ……
    _.... then after doing that, you go back and fill in the lines in between

    A lot of people do that I think, and it usually helps to keep things tidy and avoid forgetting things line the End ‘s and Next ‘s

    https://www.mrexcel.com/forum/excel-...ml#post3869151
    https://www.excelforum.com/the-water...ml#post4613355

    But I installed and tried out the Smart Identifier Add-In though.
    It seems quite neat and quick. It seems very handy to clean up codes got from somewhere else. ( I think it has a go at repairing, or at least warns if you have missed out something like a End or Next). I need to experiment a bit more with that.
    Il does not quite indent as I prefer to , - it does it like most people do, like this:

    ___ If ……..
    ______Let ….
    ___ Else ……
    ______Let ….
    ___ End If ……

    I prefer like this:

    ___ If ……..
    ____ Let ….
    ___ Else ……
    ____ Let ….
    ___ End If ……

    But a useful Add in to have. Thanks for suggesting that Add-In.

    _...

    Alan
    Last edited by Doc.AElstein; 06-24-2017 at 06:31 AM.

+ 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: 2
    Last Post: 08-26-2016, 08:14 AM
  2. How to reference spaces as spaces not zeros
    By Rob K in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-23-2015, 04:56 AM
  3. I cannot figure out the greater than formula
    By greenenergygooru in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-28-2014, 12:09 PM
  4. [SOLVED] Replacing double spaces with single spaces
    By EdWoods in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-15-2013, 01:20 AM
  5. [SOLVED] sheet1 row with spaces between cells, pulled to sheet2 column with no spaces between cells
    By chestersneakers7 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-18-2013, 05:56 PM
  6. Need to separate (and add multiple spaces or tabs
    By mattoid in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-17-2012, 02:40 AM
  7. Repost--"Ignore spaces and tabs in word search"
    By pikapika13 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2006, 02:55 PM

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