ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Repeat Formated Row (https://www.excelbanter.com/excel-programming/388494-how-repeat-formated-row.html)

clara

How to Repeat Formated Row
 
Hi all,

I have to format some cells ( such as merge, setting border, font size etc)
in one row and repeat the same in the next and next. It is boring and
inconsistency-prone. Is there a simple way to duplicate the formatting.

Clara
--
thank you so much for your help

Vergel Adriano

How to Repeat Formated Row
 
Clara,

to get you started, the code below will loop through rows 1 to 10, merge col
A and B, turn on text wrap and set a border around the merged cell.

Dim i As Integer
For i = 1 To 10
With ActiveSheet.Range("A" & i & ":B" & i)
.Merge
.WrapText = True
.BorderAround xlContinuous, xlThin, xlColorIndexAutomatic
End With
Next i

--
Hope that helps.

Vergel Adriano


"clara" wrote:

Hi all,

I have to format some cells ( such as merge, setting border, font size etc)
in one row and repeat the same in the next and next. It is boring and
inconsistency-prone. Is there a simple way to duplicate the formatting.

Clara
--
thank you so much for your help


dq

How to Repeat Formated Row
 
Clara,

Based on your question I think you're not looking for a
programmatically solution...

To do it manually in the interface: select the cells that are already
formatted an,d select Edit/Copy then select the range you want to
format the same and select Edit/Paste Special, choose formatting and
click OK.
If you turn the macro recorder on you can see haw to do this
programmatically.

DQ



All times are GMT +1. The time now is 10:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com