Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default How do I create a loop to merge contents of rows 1-4 across column

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How do I create a loop to merge contents of rows 1-4 across column

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
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




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
How do I create a loop to merge rows... Helmut Excel Programming 0 November 3rd 06 04:06 PM
How to create copy & paste loop--rows to new sheets MFR Excel Programming 0 October 25th 06 07:50 PM
loop thru column and highlight the rows mariasa Excel Discussion (Misc queries) 1 July 1st 06 08:53 AM
Merge rows depending on the value of the first column sp123[_4_] Excel Programming 0 April 19th 06 11:32 PM
How do I merge column contents Mike Excel Discussion (Misc queries) 8 February 17th 06 07:18 PM


All times are GMT +1. The time now is 09:38 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"