+ Reply to Thread
Results 1 to 2 of 2

[SOLVED] Shortcut for centring whatever is in a cell?

  1. #1
    SM
    Guest

    [SOLVED] Shortcut for centring whatever is in a cell?

    Is there any keyboard shortcut for centring whatever is inside a
    cell/selection of cells? For instance, in Word, "Ctrl E" will centre text
    on a line. Is there anything similar for Excel?



  2. #2
    Max
    Guest

    Re: Shortcut for centring whatever is in a cell?

    Don't think there's a built-in shortcut key,
    but here's a play to set-up the centring for: CTRL+j
    (Try on a spare copy/new book)

    Press Alt+F11 (to go to VBE)
    Click Insert > Module
    Copy and paste the sub CentreAcrossCells
    below into the whitespace on the right

    '---------
    Sub CentreAcrossCells()
    If Selection.Cells.Rows.Count > 1 Then
    GoTo Pop
    End If
    If Selection.Cells.Count = 1 Then
    Selection.Cells.HorizontalAlignment = xlCenter
    ElseIf Selection.Cells.Count > 1 Then
    Selection.Cells.HorizontalAlignment = xlCenterAcrossSelection
    End If
    Pop:
    End Sub
    '---------

    Press Alt+Q (get back to Excel)

    In Excel, press Alt+F8
    Select "CentreAcrossCells" in the macro list
    Click "Options"
    Enter a "j" for the shortcut key > OK

    Test it out. In any sheet:
    Select a single cell with text (say), press CTRL+j
    The text will be centred in the cell

    Select another cell with text and an empty cell just to the right of it,
    then press CTRL+j. The text will be centred across both cells

    Note that if you select more than one row, nothing will happen
    --
    Rgds
    Max
    xl 97
    ---
    Singapore, GMT+8
    xdemechanik
    http://savefile.com/projects/236895
    --
    "SM" <[email protected]> wrote in message
    news:[email protected]...
    > Is there any keyboard shortcut for centring whatever is inside a
    > cell/selection of cells? For instance, in Word, "Ctrl E" will centre

    text
    > on a line. Is there anything similar for Excel?
    >
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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