I have designed a "Russian Lotto" (Bingo-like) card with fancy borders and a 5 by 6 table (to contain random numbers. What I can't figure out is a way to AUTOMATICALLY place each one of those random numbers (in external .csv file) in one of the 30 table fields, CENTERED. It's a pain to drag n drop, then size, etc. I would happily pay for such a tool - can't find such a beast in GDG Macros or MacroMonster. Perhaps I'll have to resort to a long, complex recorded script. Thanks, fellow Forum members.
Hi!! this is exactly what I need to do at the moment and I am STUCK... Basically, I have a "revision history" table that needs to increase by 1 row every time I run the macro, and then populate the cells with some info. I've gotten so far as to selecting the correct object, adding a row... and then nothing! my idea is to count the number of rows on the table and use that as an input for the "Cell" part of a command along these lines: Shape.Custom.Cell(row number, col number).TextShape.Text.Story = "Whatever text here". I cannot for the life of me count the rows. I'm new to this and struggling. Please help?? I will be forever grateful.
I don't comprehensively understand all the details of working with tables, but here are some code snippets that might help with figuring out how to address the last row of the table or a newly-added row of the table.
In all places where I change the text, I am setting the first cell of the row to "foo", and the second cell of the row to "bar".
Sub add_row() Dim s As Shape Set s = ActiveShape s.Custom.AddRow End Sub '-------------------------------------------------------------- Sub change_text_last_row_1() Dim s As Shape Dim lngLastRowIndex As Long Set s = ActiveShape lngLastRowIndex = s.Custom.Rows.Last.Index s.Custom.cell(1, lngLastRowIndex).TextShape.Text.Story = "foo" s.Custom.cell(2, lngLastRowIndex).TextShape.Text.Story = "bar" End Sub '-------------------------------------------------------------- Sub change_text_last_row_2() Dim s As Shape Set s = ActiveShape With s.Custom.Rows.Last .cells.Item(1).TextShape.Text.Story = "foo" .cells.Item(2).TextShape.Text.Story = "bar" End With End Sub '-------------------------------------------------------------- Sub add_row_at_end_and_change_text() Dim s As Shape Set s = ActiveShape With s.Custom.AddRow .cells.Item(1).TextShape.Text.Story = "foo" .cells.Item(2).TextShape.Text.Story = "bar" End With End Sub '-------------------------------------------------------------- Sub add_row_at_row_3_and_change_text() Dim s As Shape Set s = ActiveShape With s.Custom.AddRow(3) .cells.Item(1).TextShape.Text.Story = "foo" .cells.Item(2).TextShape.Text.Story = "bar" End With End Sub
THANK YOU this is exactly what I needed. Much appreciated.