Macro : Adding Code (Font Size 14 and Merge Cell)

muhammad susanto

Well-known Member
Joined
Jan 8, 2013
Messages
2,077
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
hi all..
the following code work well. i want to adding code so can work
i have several sheets and that code work for multiple sheets. I want to :
1. automatic insert 1 row in row or cell A1 (for all sheets)
2. adding font size 14 (automatic in all sheet in cell A1 till E1
3. merge cell A1 till E1 for each sheet
VBA Code:
Sub Header()
Dim ws As Worksheet
For Each ws In Sheets
   ws.Range("A1") = "Counting -" & ws.Index
Next
End Sub

thank for your help.
.sst
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
i have trying this but no work
VBA Code:
Sub Header()
Dim ws As Worksheet
For Each ws In Sheets
   ws.Range("A1") = "Counting -" & ws.Index
   Range("A1:E1").MergeCells.Centre = True
   .font.size = 14
Next
End Sub

How to make work?
 
Upvote 0
Yet again cross posted without links.
Please supply them now & ALWAYS.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top