Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Inserting column headers

How would I write a macro that:

i)Inserts a new row in row 1 of my spreadsheet
ii)Places columns names in A1 ("Surname"),B1 ("First
Name") & C1 ("Score") and Bolds them.

Thanks in advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Inserting column headers

Try this

Sub test()
With ActiveSheet
.Range("A1").EntireRow.Insert
.Range("A1").Value = "Surname"
.Range("B1").Value = "First Name"
.Range("C1").Value = "Score"
.Range("A1:C1").Font.Bold = True
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steve" wrote in message ...
How would I write a macro that:

i)Inserts a new row in row 1 of my spreadsheet
ii)Places columns names in A1 ("Surname"),B1 ("First
Name") & C1 ("Score") and Bolds them.

Thanks in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Inserting column headers

Thanks Ron
-----Original Message-----
Try this

Sub test()
With ActiveSheet
.Range("A1").EntireRow.Insert
.Range("A1").Value = "Surname"
.Range("B1").Value = "First Name"
.Range("C1").Value = "Score"
.Range("A1:C1").Font.Bold = True
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Steve" wrote in

message ...
How would I write a macro that:

i)Inserts a new row in row 1 of my spreadsheet
ii)Places columns names in A1 ("Surname"),B1 ("First
Name") & C1 ("Score") and Bolds them.

Thanks in advance



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Inserting column headers

rows(1).Insert
Range("A1:C1").Value = Array("Surname","First Name","Score")
Range("A1:C1").font.bold = True

--
Regards,
Tom Ogilvy

"Steve" wrote in message
...
How would I write a macro that:

i)Inserts a new row in row 1 of my spreadsheet
ii)Places columns names in A1 ("Surname"),B1 ("First
Name") & C1 ("Score") and Bolds them.

Thanks in advance



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
lookup using column headers and row headers Memphus01 Excel Discussion (Misc queries) 1 April 13th 09 04:57 PM
Inserting text into custom headers / footers SyracusePete Excel Discussion (Misc queries) 3 March 22nd 07 03:38 PM
make column values column headers dunskii Excel Discussion (Misc queries) 5 September 19th 06 12:00 PM
Excel - returning column headers in a seperate column ExcelConfused Excel Discussion (Misc queries) 1 March 28th 06 02:49 PM
Matching headers and inserting values from a table jacqui[_3_] Excel Programming 0 January 12th 04 03:00 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"