Results 1 to 8 of 8

left padding (with given character)

Threaded View

  1. #4
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    Re: left padding (with given character)

    Try
    Sub CellPadding()
    Dim Length
    Dim Charac As String: Dim cellpad As String: Dim Content As String
    Dim Cl As Integer: Dim i As Integer: Dim mylength As Integer
    Content = Selection.Text
    Cl = Len(Content)
    Length = InputBox(Prompt:="Enter Padded Length", Title:="")
    Charac = InputBox(Prompt:="Enter character", Title:="")
    mylength = Length - Cl
      
        For i = 1 To mylength
           cellpad = cellpad & Charac
        Next i
    MsgBox cellpad & Content
    Selection = cellpad & Content
    End Sub
    Last edited by nigelog; 03-04-2019 at 07:54 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to use LEFT and RIGHT to delete last character
    By nicolaivinther in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-06-2014, 09:53 AM
  2. Box as rows and padding left
    By toplisek in forum Excel General
    Replies: 1
    Last Post: 07-28-2014, 04:46 AM
  3. Replies: 3
    Last Post: 11-20-2012, 10:03 PM
  4. Replies: 3
    Last Post: 10-31-2012, 11:20 PM
  5. Replies: 2
    Last Post: 08-19-2008, 07:18 AM
  6. [SOLVED] left padding + blank
    By Alex in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-05-2006, 06:25 PM
  7. left padding + blank
    By Alex in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-05-2006, 06:25 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