Macro copy button for tables 
Author Message
 Macro copy button for tables

Hi,

I have a label template which is a 26x7 grid.  I want a
macro button that copies the contents of cell (column 1
row 1) into the cells (column 2-7 inclusive, row 1) and
another button that performs the same function for the
contents of cell (column 1 row 2) into cells (column 2-7
inclusive, row 2), etc.  The macro should take into
account a blank cell.  Where do I start with this?



Mon, 01 Aug 2005 17:06:20 GMT  
 Macro copy button for tables
Hi Patrick,

The following routine will make all the cells in the current row equal the
contents of the first cell in the current row.

Dim iCl As Integer
Dim oRng As Range

Set oRng = Selection.Rows(1).Cells(1).Range
oRng.MoveEnd Unit:=wdCharacter, Count:=-1

With Selection.Rows(1)
    For iCl = 2 To .Cells.Count
        .Cells(iCl).Range.FormattedText = oRng.FormattedText
    Next iCl
End With

HTH


Quote:
> Hi,

> I have a label template which is a 26x7 grid.  I want a
> macro button that copies the contents of cell (column 1
> row 1) into the cells (column 2-7 inclusive, row 1) and
> another button that performs the same function for the
> contents of cell (column 1 row 2) into cells (column 2-7
> inclusive, row 2), etc.  The macro should take into
> account a blank cell.  Where do I start with this?



Mon, 01 Aug 2005 21:58:02 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. MACROS: copying macro from one PC to another

2. Using a VBA Macro to copy a VBA Macro

3. Copying DBGrid contents to clipboard (Or copying a table from a Data component to clipboard)

4. macro for converting EMF tables in Word to normal cellular Tables

5. Copy fields from record in table A to record in table B using VBA

6. Copy Record from Table 1 to Table 2 - Acc97 - VBA

7. HowTo Copy a Recordset from a Table to an identically structured table

8. Copying the structure of a table to a new table

9. Copying Table text to tables

10. Copy a Table to another Table

11. Copying table definition to create new table

12. Copy a Table to another Table

 

 
Powered by phpBB® Forum Software