Hi Ron
Thanks for replying, this the macro and function I am using
Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function
Sub Copy_Next_Each_Other()
Dim smallrng As Range, DestRange As Range
Dim DestSheet As Worksheet, Lr As Long
Dim SourceRange As Range, I As Integer
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
'fill in the Source Sheet and range
Set SourceRange =
Sheets("Sheet1").Range("J3,F6:G6,F7:G7,F8:G8,F9,F10,G11,F12:G12,F16:G16,F17:G17,F18:G18,F19:G19,F20:G20,F21:G21,F22:G22,F23:G23,F24:G24,F25:G25,F26:G26,F27:G27,F28:G28,F29:G29,F32,F33:G33,F34:G34,F35:G35,F36:G36,F37:G37,N6:O6,N7:O7,N8,N9,N11,N12,N13,N14,N15,O16,O17,N18:O18")
'Fill in the destination sheet and call the LastRow
'function to find last row
Set DestSheet = Sheets("Data")
Lr = LastRow(DestSheet)
I = 1
For Each smallrng In SourceRange.Areas
'We make DestRange the same size as smallrng and use the
'Value property to give DestRange the same values
With smallrng
Set DestRange = DestSheet.Cells(Lr + 1, I) _
.Resize(.Rows.Count, .Columns.Count)
End With
DestRange.Value = smallrng.Value
I = I + smallrng.Columns.Count
Next smallrng
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
Range("J3,D6:E14,G6:G8,G10:G14,D16:E30,G16:G30,D32:E37,G33:G37,L6:M9,O6:O7,L11:M15,O16:O21,L18:M30,O33,L35:L36,L40").Select
Selection.ClearContents
End Sub
regards
Tredown
"Ron de Bruin" wrote:
> Hi Tredown
>
> Can you give me the link to the macro example you use now
> We can find a solution for you then
>
> --
>
> Regards Ron de Bruin
> http://www.rondebruin.nl/tips.htm
>
>
> "Tredown" <(E-Mail Removed)> wrote in message news
C3B0300-4E4E-4298-BAF0-(E-Mail Removed)...
> >I an using your copy next each other sub and last row function.
> > My question is there a maximum number of ranges that can be used within the
> > Set sourceRange = Sheets("Sheet1").Range statement. I have 41 ranges which
> > works fine but as soon as i add further ranges i get a run time error 1004.
> > If there is a maximum is there away to increase it.
> > Thanks in anticipation
> > Tredown
>