Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6803965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:24:31+00:00 2026-05-26T19:24:31+00:00

Can anyone offer any VBA macro suggestions? In a Word doc table, I need

  • 0

Can anyone offer any VBA macro suggestions?

In a Word doc table, I need to apply the following rule to the 1st column only:

I need to add zeroes (0s) to the front of numbers to bring them up to a total of 8 characters long. All of the numbers end with a letter or two, which are to be included in the 8 character count.

For example:

2020A (5 characters) must read 0002020A (8 characters)
123456AB (8 characters) remains unchanged
765432X (7 characters) must read 0765432X (8 characters)

How do I apply this to every field in the FIRST COLUMN ONLY of a table on a Word doc?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:24:32+00:00Added an answer on May 26, 2026 at 7:24 pm

    Answer provided by macropod on vbaexpress forum:

    Dim RngCel As Range, oCel As Cell, oTbl As Table 
    For Each oTbl In ActiveDocument.Tables 
        For Each oCel In oTbl.Columns(1).Cells 
            Set RngCel = oCel.Range 
            RngCel.End = RngCel.End - 1 
            While Len(RngCel.Text) < 8 
                RngCel.InsertBefore "0" 
            Wend 
        Next oCel 
    Next oTbl
    

    http://www.vbaexpress.com/forum/showthread.php?p=254288#post254288

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can anyone offer any suggestions as to why wp-admin/options-general.php won't load on my Wordpress
Can anyone suggest a CMS able to offer the following features: Free/open source Support
I am receiving this error when trying to use RedirectToAction, can anyone offer any
can anyone offer a selector to do away with this horrible chunk of code:
Can anyone suggest the best way to offer a file for download within a
Can anyone offered syntax for a sql query that takes an already created table
Can anyone (maybe an XSL-fan?) help me find any advantages with handling presentation of
Can anyone recommend a .NET winforms control that offers similar functionality to the address
Can anyone shed light on this for me? undefined method `first_name' for # Here
Can anyone direct me to a good tutorial for sqlite browser. I cant seem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.