Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 08-17-2015, 02:30 PM
ccguillermo ccguillermo is offline Craete a set of number in a Table?? Windows 8 Craete a set of number in a Table?? Office 2010 64bit
Novice
Craete a set of number in a Table??
 
Join Date: Aug 2015
Posts: 3
ccguillermo is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 08-17-2015, 08:57 PM
gmayor's Avatar
gmayor gmayor is offline Craete a set of number in a Table?? Windows 7 64bit Craete a set of number in a Table?? Office 2010 32bit
Expert
 
Join Date: Aug 2014
Posts: 4,103
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

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
Reply With Quote
  #3  
Old 08-18-2015, 08:31 AM
ccguillermo ccguillermo is offline Craete a set of number in a Table?? Windows 8 Craete a set of number in a Table?? Office 2010 64bit
Novice
Craete a set of number in a Table??
 
Join Date: Aug 2015
Posts: 3
ccguillermo is on a distinguished road
Default

Thank you for you help
Reply With Quote
  #4  
Old 08-18-2015, 03:33 PM
ccguillermo ccguillermo is offline Craete a set of number in a Table?? Windows 8 Craete a set of number in a Table?? Office 2010 64bit
Novice
Craete a set of number in a Table??
 
Join Date: Aug 2015
Posts: 3
ccguillermo is on a distinguished road
Default 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
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Craete a set of number in a Table?? 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
Craete a set of number in a Table?? How Can I Use a Page Number in a Table Header Row jqavins Word 8 01-10-2014 08:43 AM
Craete a set of number in a Table?? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 05:57 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft