+ Reply to Thread
Results 1 to 5 of 5

View number of columns from selected cells

Hybrid View

  1. #1
    Registered User
    Join Date
    02-14-2014
    Location
    Rome
    MS-Off Ver
    Excel 2010
    Posts
    3

    View number of columns from selected cells

    Hello to all of the forum,
    I'm looking for a solution to a problem ...
    When I select multiple cells horizontally at the top are highlighted columns for those cells.
    I would need to know the number of those columns (es. 5), "on the fly", without having to rely on eye every time. This number maybe displayed in a status bar or other window...

    Thanks in advance
    Massimo

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: View number of columns from selected cells

    Put this in the worksheet module:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.StatusBar = "Selected columns: " & Selection.Columns.Count
    End Sub
    
    Private Sub Worksheet_Deactivate()
    Application.StatusBar = False
    End Sub
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    02-14-2014
    Location
    Rome
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: View number of columns from selected cells

    Hello, unfortunately I do not know the programming in Excel.
    The code you write I understand what makes (approximately), the problem is that I do not know where to place it or how to make it perform better and also what to expect in terms of visualization.
    The value for example where I show up?

    What I need should be "interactive" we say, that when I select a number of cells, "on the fly" somewhere I immediately displays the number.

    I would take steps so even step-by-step to run the code and get the result.

    thanks
    Massimo
    *sorry for bad english

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: View number of columns from selected cells

    Right click the worksheet name, then click 'view code'. Paste my code in the worksheet module that appears.

    The number of columns in the current selection will then be displayed in the statusbar, and will update every time your selection changes.

  5. #5
    Registered User
    Join Date
    02-14-2014
    Location
    Rome
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: View number of columns from selected cells

    Olly, It work fine!!!!
    Very very well! Many thanks...

    Massimo

+ 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] copy selected data into column A cells if column B contains text
    By El Conquistador in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-05-2013, 02:51 PM
  2. [SOLVED] Counting up cells with the same number value and then view it as the nuber 1
    By AjTeX in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-18-2013, 07:03 AM
  3. [SOLVED] how to pick number from selected column
    By Shermaine2010 in forum Excel General
    Replies: 4
    Last Post: 07-25-2012, 10:18 PM
  4. View only user selected cells
    By WashCaps in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-01-2010, 01:41 AM
  5. [SOLVED] column is hidden in normal view but not print view
    By Bianca in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-23-2006, 03:45 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