Macro to chance cells in selection, and create a summary table of the table

Hiring

Job #: 10177 Post Date: 09.07.2017

General information for the business: Cyber Security Num. of modules: 2 Description of every module: I have a bunch of tables in a document that look roughly like this: | Thing | Title | |-----------|:---------:| | Info | A, B, C. | | Score | Foo | | More Info | Long Text | | Proof | Blah | Figure 1 I'd like to make it look like this (Number in the upper left cell): | Thing #1 | Title | |-----------|:-----------------:| | Info | A, B, C. | | Score | Foo | | More Info | Long Text | | Proof | Blah | But, the there are many tables in the document, and I'd only like to use the ones "within selection". In short: I have to take all tables within a selection and number them sequentially. I'd also like to make a table of these tables that looks like this: | Number | Title | Score | Number of CSV's in Info | |--------|:-----:|-------|-------------------------| | 1 | Thing | Foo | 3 | | ... | ... | ... | ... | | ... | ... | ... | ... | | ... | ... | ... | ... | Description of requirements/functionality: The only requirement is that it should work. Specific technologies required: Word VBA Extra notes: https://stackoverflow.com/questions/44684892/word-vba-macro-to-chance-cells-in-selection-and-create-a-summary-table-of-the I have a bunch of tables in a document that look roughly like this: | Thing | Title | |-----------|:---------:| | Info | A, B, C. | | Score | Foo | | More Info | Long Text | | Proof | Blah | Figure 1 I'd like to make it look like this (Number in the upper left cell): | Thing #1 | Title | |-----------|:-----------------:| | Info | A, B, C. | | Score | Foo | | More Info | Long Text | | Proof | Blah | But, the there are many tables in the document, and I'd only like to use the ones "within selection". In short: I have to take all tables within a selection and number them sequentially. I'd also like to make a table of these tables that looks like this: | Number | Title | Score | Number of CSV's in Info | |--------|:-----:|-------|-------------------------| | 1 | Thing | Foo | 3 | | ... | ... | ... | ... | | ... | ... | ... | ... | | ... | ... | ... | ... | Here is what I have so far: Numbering Tables: Sub NumberTablesSelection() Dim t As Integer Dim myRange as Range Set myRange = Selection.Range With myRange For t = 1 To .Tables.Count Set myCell = .Tables(t).Cell(1,1).Range myCell.Text = "Thing #" + t Next t End With End Sub Table of Tables (with info): Sub TableOfThings() Dim t As Integer Dim myRange as Range Set myRange = Selection.Range myTable = Tables.Add(Range:=tableLocation, NumRows:=1, NumColumns:=4) myTable.Cell(1,1).Range.Text = "Number" myTable.Cell(1,2).Range.Text = "Title" myTable.Cell(1,3).Range.Text = "Score" myTable.Cell(1,4).Range.Text = "Instances" With myRange For t = 1 To .Tables.Count Set Title = .Tables(t).Cell(1,2).Range Set Instances = .Tables(t).Cell(2,2).Range Set Score = .Tables(t).Cell(3,2).Range Set NewRow = myTable.Rows.Add NewRow.Cells(1).Range.Text = t NewRow.Cells(2).Range.Text = Title NewRow.Cells(3).Range.Text = Score NewRow.Cells(4).Range.Text = Instances End With End Sub But they flat out don't work the way I want them to, and I can't seem to manage to get them to work. Could someone provide me with a solution?

Posted by

Required skills

AssemblerGTK.NET

Get the job done

Budget:
$30
-$136
Job type:
One-time
Hiring from:

?Bidding for first time? Click here to learn how StartAJob platform works.

?Want to do the job or have questions for the customer? Write then in the " Write a note or message to the customer"

?You already have the estimated cost and time to complete the work yuo are in the fields "Execution time" and "Payment requested" or leave them empty and can be changed later.

Invite

Generated in 0.631 sec