Home | Tips | Library | Other Authors | Other WP Sites | Writer's Links | Contact | Site Map | Donate

Barry MacDonnell's
Toolbox for WordPerfect

Macros, tips, and templates for Corel® WordPerfect® for Windows®
© Copyright 1996-2019 by Barry MacDonnell. All Rights Reserved.

Page updated Jan 28, 2019

Macros that can add incrementing numbers or dates in a table column
with optional prefix and/or suffix characters

Download QWIKFILL.ZIP (v1.3; 01/25/19; 39,457 bytes)

WordPerfect 11 users: See important information about using macros in the first release of WP11 (11.0.0.233) at the top of this page.

Downloading, Documentation, Modifications, and Support



Related pages -

Using WordPerfect tables - Dozens of tips and links to related resources


The QWIKFILL.ZIP file contains 2 macros:

QwikFill.wcm: Adds incrementing numbers (1..n) in the current table column from the current cell to the bottom of the column, in a manner similar to WordPerfect's QuickFill feature but easier and with more options (i.e., optional user-specified prefix and/or suffix and/or optional fixed-width Bates numbering).

QwikFill Dates.wcm: Automatically fills a series of table cells — even dozens or hundreds of them — in the current table column with your chosen dates (in plain text), each date incremented by a chosen interval (e.g., every "n" days/weeks/months/years)


QwikFill.wcm (v1.3) is a WordPerfect 9 (and later version) macro that adds incrementing numbers (1..n) in the current table column from the current cell to the bottom of the column, in a manner similar to WordPerfect's QuickFill feature 1 -- but easier and with more options. [Screen shot of the macro's menu.]

You can add your own prefix and/or suffix characters to numbers, such as "#" and/or periods/full stops or other punctuation marks. Characters can include symbols (with Insert>Symbol or <Ctrl+W>).

You can also use fixed-width Bates numbers (i.e., numbers padded with leading zeros).

Any column in the table can be numbered, starting in any row. Simply place your cursor in the desired "beginning" cell and play the macro. (See "Known limitations" below.)

Examples

Plain numbering (like
WordPerfect's QuickFill

feature):
1    
2    
3    
Prefix added
to numbers:

#1    
#2    
#3    
Suffix added
(period/full stop):

1.    
2.    
3.    
Perfix and
suffix added:

(1)    
(2)    
(3)    
Bates ("fixed width") numbers:
[See also BATES in the Library.]

001    
002    
003    
Bates ("fixed width") numbers,
with a prefix and a suffix:

#001:    
#002:    
#003:    

How it works

From the current table cell, this macro -

(1) deletes any existing items (cell contents and formulas) in the current column from the cursor location to the last cell in that column; then it

(2) adds incrementing numbers (1 .. n) in that column up to, and including, the last cell in that column.

Caution: Obviously, since the macro deletes any existing items in some cells, you should make a backup of your document first.

Modifications

See the redlined User Modifcation Area in the macro's code. (You can open the macro like any other WordPerfect document, make changes, and then click the Save & Compile button on the macro toolbar.)

Known limitations and caveats

(1) The column cells' Numeric Format must be set to General (the typical default) and not to Text or other format style.

Starting with version 1.3 the macro will do this automatically. But if you wish to do it manually in any table:

Tip: To set a column to General format the easy way:

(a) Move the cursor in a cell to near the top border of the cell until it turns into an upward-pointing arrow --
Up arrow cursor in table cell
(b) then double click your mouse to select the entire column;
(c) then right-click in the selected column and choose Numeric Format, General;
(d) then click OK.

(2) The macro language does not offer a way to detect if the cursor is in a header row of a table. (See Table, Format, Row for the header row setting in effect for the current row.) Be sure to start numbering in a non-header row.

Tip
You can sssign this macro to a menu, keystroke combination, or toolbar button. See here.


QwikFill Dates.wcm (v1.0) is a macro that automatically fills a series of table cells — even dozens or hundreds of them — in the current table column with your chosen dates (in plain text), each date incremented by a chosen interval (e.g., every "n" days/weeks/months/years).

Example: Type numerical dates into a table column (and add weekdays to each date) for every other day starting on Jan. 25, 2019:

1/25/2019 (Friday)

1/27/2019 (Sunday)

1/29/2019 (Tuesday)

1/31/2019 (Thursday)

Dates are automatically calculated based on a starting date (the default is the current date but you can specify another date), so months with less than 31 days as well as leap years are taken into account when incrementing the dates.  [All dates are calendar dates; hence the macro includes weekends and holidays in its calculations.]

The macro can be useful when you need to print a date-specific schedule, task list, diary, or other documentation using flexible periodic dates in any of 24 formats — including several with appended weekday names — e.g., January 31, 2023 (Tuesday).

Optionally, you can include extra text characters or symbols (e.g., a checkbox) from a menu to include before and/or after each date.

Note that a table, as used here, is simply a formatting tool:

Unlike using (e.g.) a typical monthly-calendar-on-a-page (there's a macro for that!) a table allows formatting larger amounts of date-specific material using adjacent table cells — which items are easy to manually select and copy later into multiple cells. Further, the typed dates can then act as paragraph or section headings for each adjacent block of material.

When you have finished playing the macro you can change or remove the table's lines and borders, or even remove the table's entire structure (leaving behind just the dates and optional text), with a few mouse clicks (see the tips below).

Operation

When played with the cursor located inside a table cell, a menu will appear to let you specify the:

•  start date for the desired range of cells [Year, Month, Day (the default is the current date)];
•  number of dates to insert in the current column (max=9999);
•  number of rows between each of the dates (can be used for extra material or as spacing);
•  number of days, weeks, months or years between each date (i.e., the interval period);
•  format (i.e., dates in all numbers, or dates composed of both names and numbers); and
•  any text or symbols (e.g., a checkbox inserted with Ctrl+W) to add before and/or after each inserted date.

Since all dates are simply typed into the cells they can be formatted in a large variety of ways — e.g., numbers only, mixed text and numbers, day before month and vice versa, etc.

The desired format for all typed dates in the range can be quickly selected from representative examples displayed in the menu's drop list.

The best way to see how it works is to -

•  open a new blank document,
•  use Table, Create to create a multi-row table, and
•  play the macro with the cursor in any cell.

Operational notes

•  This macro does NOT use WordPerfect's built-in QuickFill feature (on the program's Table menu choice). Instead, it calculates each date, formats it, and types it into the appropriate table cell as plain text. Hence the dates are not designed for further calculation.

•  Existing cell contents are deleted: The macro deletes any existing items — both cell contents and formulas — in each cell in the specified insertion range. Be sure to use a range of cells that are empty or do not contain important material.

•  "Short" tables: If the table doesn't have enough available rows for the desired number of dates the macro will stop and exit at the end of the column. A message will appear to alert you about the issue. You can always add more rows (Table, Insert, Rows) and play the macro again with the cursor in the same (or different) "start date" cell.

•  Table header rows: The macro language does not offer a way to detect if the cursor is in a header row of a table when you start playing the macro. (See Table, Format, Row for the header row setting in effect for the current row.) Be sure to start the date insertions in a non-header row.

Tips

•  You can always immediately undo date insertions with Edit, Undo (or with Ctrl+z).

•  Your desired menu defaults can be set in the redlined User Modification Area.

•  The entire range of dates can be selected to apply custom text formatting to it (e.g., new font, text attributes, size, color, etc.).

•  If you prefer slightly different date formatting — e.g., use periods (full stops) instead of slash marks as date separators — you can simply select the table rows containing the dates and use Edit, Find and Replace to change from one to the other. (For more permanent changes you can modify any of the 24 provided date formats in the User Modification Area.)

•  To type the last day of every "n" months, set the Start date's Day field to 31 and choose month(s) for the Interval. As with other intervals you can choose, months with less that 31 days (February, April, June, September, and November) and leap year dates will be automatically adjusted.

•  You can split any table into one or more separate tables with Table, Split. Once split, your can add hard returns or page breaks between them: Use Reveal Codes to place the cursor above the split (i.e., just to the left side of the [Tbl Def] code) and then press Enter (or Ctrl+Enter for page breaks).

•  As with any table, you can add, remove or change table borders and fills with Table, Borders/Fill. For more tips on using and formatting WordPerfect tables see https://wptoolbox.com/tips/TablTips.html.

•  You can convert any WordPerfect table to ordinary document text with Table, Convert. This removes the table structure — lines, borders, and fills. You are given the choice to separate cells in the same rows with commas, hard returns, tabs, etc. (Most likely you would choose tabs.) Note that the cursor must be inside the table to convert it.



Footnote 1

WordPerfect has a QuickFill feature for tables, which can increment dates as well as numbers (Arabic and Roman).

It cannot, however, automatically add custom prefix and/or suffix text like the QwikFill macro.

From WordPerfect X6's Help (F1):

To fill a table with incremental numbers or dates

1.   Select the cells that contain the incremental or decremental pattern of values as well as the cells in which you want to continue the pattern.

2.   Click Table > QuickFill.

Note

You can use Roman numerals, days of the week, months, or quarters, even if only one cell is used to establish the pattern. To repeat incremental or decremental numbers, however, you must select at least two cells with values to establish a pattern. 

Tip

You can also fill a table with incrementing numbers or dates by clicking the QuickFill button on the Table formula toolbar. To display the Table formula toolbar, click Table > Formula toolbar.