Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Repeat entries in rows 5 & 6 into next blank column

Hi,

I have headings in rows 5&6 which I would like repeated in the next blank
column or columns to the right. Each heading needs to be repeated until nth
column which has data.

The macro should start looking for data to repeat from column "E" onwards
and autofill say column "F" rows 5 & 6 if blank.

Thank


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Repeat entries in rows 5 & 6 into next blank column

I am not sure you want AutoFill. Try this first:

Sub ExpndHdng()
lstc = ActiveSheet.Cells(7, Columns.Count).End(xlToLeft).Column
Range("$E$5:$E$6").Copy Range(Cells(5, 5), Cells(6, lstc))
End Sub

If this does not do what you want, then post back with more detail.

"manfareed" wrote:

Hi,

I have headings in rows 5&6 which I would like repeated in the next blank
column or columns to the right. Each heading needs to be repeated until nth
column which has data.

The macro should start looking for data to repeat from column "E" onwards
and autofill say column "F" rows 5 & 6 if blank.

Thank


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Repeat entries in rows 5 & 6 into next blank column

manfareed,
I think this is what your asking for.

Sub Manfreed()

Dim LastCell As String

'look for the last data value
Range("e7").Select
Selection.End(xlToRight).Select
ActiveCell.Offset(0, 0).Select
LastCell = ActiveCell.Offset(-1, 0).Address
LastCell = Replace(LastCell, "$", "")
LastCell = "E5:" & LastCell & ""

'Copy and paste it
Range("E5:E6").Select
Selection.Copy
Range(LastCell).Select
ActiveSheet.Paste
Application.CutCopyMode = False

'Return to E5
Range("E5").Select
End Sub

"manfareed" wrote:

Hi,

I have headings in rows 5&6 which I would like repeated in the next blank
column or columns to the right. Each heading needs to be repeated until nth
column which has data.

The macro should start looking for data to repeat from column "E" onwards
and autofill say column "F" rows 5 & 6 if blank.

Thank


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Repeat entries in rows 5 & 6 into next blank column

JLGWhiz,

This is a lot easier than my suggestion!


"JLGWhiz" wrote:

I am not sure you want AutoFill. Try this first:

Sub ExpndHdng()
lstc = ActiveSheet.Cells(7, Columns.Count).End(xlToLeft).Column
Range("$E$5:$E$6").Copy Range(Cells(5, 5), Cells(6, lstc))
End Sub

If this does not do what you want, then post back with more detail.

"manfareed" wrote:

Hi,

I have headings in rows 5&6 which I would like repeated in the next blank
column or columns to the right. Each heading needs to be repeated until nth
column which has data.

The macro should start looking for data to repeat from column "E" onwards
and autofill say column "F" rows 5 & 6 if blank.

Thank


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Repeat entries in rows 5 & 6 into next blank column

Hi,

The first heading needs only to be repeated until the next column is reached
with data. For example from column E as the start point. If "E" has data and
then next column with data is "K" . The data from "E" should only populate up
to column "I" and so on. After column "K" blank rows 5&6 should be populated
by data in column "K".

Thanks,



"manfareed" wrote:

Hi,

I have headings in rows 5&6 which I would like repeated in the next blank
column or columns to the right. Each heading needs to be repeated until nth
column which has data.

The macro should start looking for data to repeat from column "E" onwards
and autofill say column "F" rows 5 & 6 if blank.

Thank




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 130
Default Repeat entries in rows 5 & 6 into next blank column

manfareed,

So is there a headings in column k and others?

"manfareed" wrote:

Hi,

The first heading needs only to be repeated until the next column is reached
with data. For example from column E as the start point. If "E" has data and
then next column with data is "K" . The data from "E" should only populate up
to column "I" and so on. After column "K" blank rows 5&6 should be populated
by data in column "K".

Thanks,



"manfareed" wrote:

Hi,

I have headings in rows 5&6 which I would like repeated in the next blank
column or columns to the right. Each heading needs to be repeated until nth
column which has data.

The macro should start looking for data to repeat from column "E" onwards
and autofill say column "F" rows 5 & 6 if blank.

Thank


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Repeat entries in rows 5 & 6 into next blank column

Hi,

Yes there are headings in other columns but in between there will be blank
columns.
Each time I run a report with different data the columns with headings also
change.

Thanks,

Manir

"JRForm" wrote:

manfareed,

So is there a headings in column k and others?

"manfareed" wrote:

Hi,

The first heading needs only to be repeated until the next column is reached
with data. For example from column E as the start point. If "E" has data and
then next column with data is "K" . The data from "E" should only populate up
to column "I" and so on. After column "K" blank rows 5&6 should be populated
by data in column "K".

Thanks,



"manfareed" wrote:

Hi,

I have headings in rows 5&6 which I would like repeated in the next blank
column or columns to the right. Each heading needs to be repeated until nth
column which has data.

The macro should start looking for data to repeat from column "E" onwards
and autofill say column "F" rows 5 & 6 if blank.

Thank


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Repeat entries in rows 5 & 6 into next blank column

Hi,

This is now ok ...

Thanks,

Manir

"manfareed" wrote:

Hi,

I have headings in rows 5&6 which I would like repeated in the next blank
column or columns to the right. Each heading needs to be repeated until nth
column which has data.

The macro should start looking for data to repeat from column "E" onwards
and autofill say column "F" rows 5 & 6 if blank.

Thank


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
Dynamically sized table compiled from unsorted rows with blank entries Ezra[_3_] Excel Worksheet Functions 2 January 31st 12 03:12 PM
Use formula to remove blank entries from a column Pete J Excel Worksheet Functions 8 June 18th 09 08:01 PM
printing issue - want to repeat two rows and also 5 rows in column cliffykat Excel Discussion (Misc queries) 0 August 29th 07 10:36 PM
How do I transpose entries that repeat in sequence down a column . Anzacdave Excel Programming 1 March 7th 05 04:04 AM
Excel VBA - Repeat for loop until blank rows rbelforti[_4_] Excel Programming 1 July 7th 04 10:48 PM


All times are GMT +1. The time now is 09:45 AM.

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

About Us

"It's about Microsoft Excel"