Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Programatically assigning values to table cells
Hello guys:
I have table on a one-page doc that's designed to fit with a label sheet (4 by 10), I want to programatically assign a sequence of numbers with repeatition to the cells in this manner: 1 1 2 2 3 3 4 4 .................... 20 20 21 21 I have this code I got from utteraccess forum, but it was for excel, and am not sure if works with word. I made a button and added the code but it asked me to enable macros! Here is the code: Private Sub CommandButton1_Click() Dim i As Integer Dim k As Integer ActiveSheet.Range("A1").Select k = 1 For i = 1 To 1000 ActiveCell.Offset(k - 1, 0).Value = i ActiveCell.Offset(k - 1, 1).Value = i i = i + 1 k = k + 1 ActiveCell.Offset(k - 2, 2).Value = i ActiveCell.Offset(k - 2, 3).Value = i Next i End Sub Thank you very much. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Table Format Style vs. Table Text Style | Page Layout | |||
Select specific cells in table via macro | Microsoft Word Help | |||
Table headers/footers and layout | Page Layout | |||
Table AutoFormats vs. Table Styles confusion | Tables | |||
Automatic calculation as data is entered into table cells | Microsoft Word Help |