Select COPY range based upon MAX in Column

CordingBags

New Member
Joined
Mar 7, 2022
Messages
37
Office Version
  1. 2016
Platform
  1. Windows
I am trying to write / find a MACRO to copy a range from the Current Sheet to another sheet, FIXTURES
Range is based upon the MAX value in column F
Then range will extend from column D to column N
Copy range commences at D1 and may go as far as N318, but should stop at N???, based on MAX value in column F.
Plus one row.
ie if MAX is row 107 then copy area D1:N108

Any help appreciated
Thanks
Paul
 
If at first...
VBA Code:
Option Explicit
Sub CordingBags_V3()
    Dim ws1 As Worksheet, ws2 As Worksheet, rng As Range, r As Range, i As Long, d As Date
    Set ws1 = ActiveSheet
    Set ws2 = Worksheets("FIXTURES")
    Set rng = ws1.Columns("F")
    
    d = Application.Max(rng)
    Set r = rng.Find(d)
    i = r.Row
    
    If i > 0 Then
        ws1.Range("D1:N" & i + 1).Copy
        ws2.Range("D1").PasteSpecial xlPasteValues
        Application.CutCopyMode = False
    End If
End Sub
 
Upvote 0
Solution

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Sub CordingBags_V3() Dim ws1 As Worksheet, ws2 As Worksheet, rng As Range, r As Range, i As Long, d As Date Set ws1 = ActiveSheet Set ws2 = Worksheets("FIXTURES") Set rng = ws1.Columns("F") d = Application.Max(rng) Set r = rng.Find(d) i = r.Row If i > 0 Then ws1.Range("D1:N" & i + 1).Copy ws2.Range("D1").PasteSpecial xlPasteValues Application.CutCopyMode = False End If End Sub
Fantastic, again Many Thanks for Your Help
Chers
Paul
 
Upvote 0

Forum statistics

Threads
1,215,353
Messages
6,124,458
Members
449,161
Latest member
NHOJ

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top