View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
L. Howard L. Howard is offline
external usenet poster
 
Posts: 852
Default Copy to the rows between 49 up to 29

On Friday, July 31, 2015 at 7:50:02 AM UTC-7, Claus Busch wrote:
Hi again,

Am Fri, 31 Jul 2015 16:30:03 +0200 schrieb Claus Busch:

try it with:

Sub Copy()


better try:

Sub Copy()
Dim FERow As Long, LRow As Long, LCol As Long
Dim c As Range

With ActiveSheet
FERow = WorksheetFunction.Max(29, .Cells(Rows.Count,
1).End(xlUp).Offset(1, 0).Row)
If FERow 49 Then
MsgBox "Exceeding Range"
Exit Sub
End If
LRow = .Cells(Rows.Count, 5).End(xlUp).Row
Set c = .Range("E1:E" & LRow).Find("eex4", LookIn:=xlValues,
lookat:=xlWhole)
If Not c Is Nothing Then
LCol = .Cells(c.Row, Columns.Count).End(xlToLeft).Column
.Cells(FERow, 1).Resize(columnsize:=LCol - 4).Value = _
.Range(.Cells(c.Row, 5), .Cells(c.Row, LCol)).Value
End If
End With
End Sub


This works quite well, and I will keep the other non array code also. I did have to change this If FERow = 50 Then to If FERow < 50 Then.

I assume that was a typo, as it works in the brief test I did.

Good stuff, as always, I thank you Claus.

I'll be sure to make sufficient notes on these codes, and with the whole macros intact in a workbook example that will help.

Thanks again.

Howard