#1
|
|||
|
|||
Craete a set of number in a Table??
hello
I have a table; I need to create a set of number in that table. it is how I need to do this: W001 L001 W002 L002 W003 L003 W00N L00N The N will be 100 numbers. it has to go in the Column of the table. how I can create a macro or VBA code to Create the set of number in each Row I have to create each time at least 100 set of number. some body have idea how create that one. Thank you very much. for you help.. Carlo |
#2
|
||||
|
||||
How about
Code:
Sub NumberTable() Dim oRow As Row Dim oRng As Range Dim lCount As Long Dim wCount As Long Dim i As Long lCount = 1 wCount = 1 With ActiveDocument.Range.Tables(1) For i = 1 To .Rows.Count Set oRow = .Rows(i) If i Mod 2 = 0 Then Set oRng = oRow.Cells(1).Range oRng.End = oRng.End - 1 oRng.Text = "L" & Format(lCount, "000") lCount = lCount + 1 Else Set oRng = oRow.Cells(1).Range oRng.End = oRng.End - 1 oRng.Text = "W" & Format(lCount, "000") wCount = wCount + 1 End If Next i End With lbl_Exit: Set oRow = Nothing Set oRng = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
#3
|
|||
|
|||
Thank you for you help
|
#4
|
|||
|
|||
Create a set of number in a table??
I forgot to mention in my problems I need to start in Row 2 and columns 2
and create at least 100 set of numbers. Thank you |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to create a table with a number of line depending a number entered by user | Cellendhyll | Word Tables | 3 | 07-10-2014 05:49 AM |
How Can I Use a Page Number in a Table Header Row | jqavins | Word | 8 | 01-10-2014 08:43 AM |
Page number in table of Content | Ritu | Office | 1 | 09-19-2011 05:10 AM |
Different Table Number System | Nebabon | Word | 0 | 08-30-2010 10:23 AM |
Different Table Number System | Nebabon | Word Tables | 0 | 08-27-2010 03:16 PM |