View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Helmut Helmut is offline
external usenet poster
 
Posts: 111
Default How do I create a loop to merge contents of rows 1-4 across co

Peter;
Thank you I'll give a try as well as your alternative suggestion. Time
well spent.
Helmut


"Peter T" wrote:

Sub MergeHeaders()
Dim rng As Range, rCol As Range

Set rng = Range("A1:FG4")
rng.MergeCells = False
For Each rCol In rng.Columns
rCol.Merge
Next

End Sub

if you don't want any warnings about loosing data in cells about to be
merged start with
Application.displayalerts = false and reset same to true when done.

Instead of merging why not select the row-1, adjust height to that of 4 rows
and format wrap text.

Regards,
Peter T

"Helmut" wrote in message
...
Unfortunately, my Excel VBA Programming skills are weak. I need help in
creating a loop to merge rows by column. I have a spreadsheet that loads

a
text file for any numbers of rows. I need to reserve rows 1-4 for column
heading information. the column spread is "a" - "FG". Can someone give me

a
shell to work with?
Thank you