selecting, copying and pasting from two non adjacent columns of data from a maxvalue in first column

steve11

New Member
Joined
Dec 21, 2017
Messages
3
Hi I am wanting to be able to find a max value in my first column (J and M) and from that index, copy the remaining row values in both that column and a non adjacent column, then paste these in the same sheet to 2 blank columns (say R and S) . Any ideas welcomed

Many thanks

Steve
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
If I undertood you correctly this shouold work.

Code:
Sub Scapf2nacodfamifc()
Dim fRow As Long
Dim lRow As Long


lRow = Cells(Rows.Count, 10).End(xlUp).Row
fRow = WorksheetFunction.Index(Range("J:J"), WorksheetFunction.Match(WorksheetFunction.Max(Range("J:J")), Range("J:J"), 0)).Row


Range(Cells(fRow, 10), Cells(lRow, 10)).Copy Range(Cells(fRow, 24))
Range(Cells(fRow, 13), Cells(lRow, 13)).Copy Range(Cells(fRow, 25))


Application.CutCopyMode = False
End Sub
 
Upvote 0
I tested this one I use this one.

Code:
Sub Scapf2nacodfamifc()
Dim fRow As Long
Dim lRow As Long




lRow = Cells(Rows.Count, 10).End(xlUp).Row
fRow = WorksheetFunction.Index(Range("J:J"), WorksheetFunction.Match(WorksheetFunction.Max(Range("J:J")), Range("J:J"), 0)).Row




Range(Cells(fRow, 10), Cells(lRow, 10)).Copy Range(Cells(fRow, 19).Address)
Range(Cells(fRow, 13), Cells(lRow, 13)).Copy Range(Cells(fRow, 18).Address)




Application.CutCopyMode = False
End Sub
 
Upvote 0
Many thanks for this Truiz, i don't think i explained very well. I want to look down column D for the max value, then take this row index and use it to copy and paste from columns J and M from this row index to the last values in columns J and M to the top of columns R and S.

Steve
 
Upvote 0
Ok so just need to adjust the columns a bit

Try this

Code:
[COLOR=#333333]Sub Scapf2nacodfamifc()
[/COLOR]Dim fRow As Long
Dim lRow As Long

lRow = Cells(Rows.Count, 10).End(xlUp).Row
fRow = WorksheetFunction.Index(Range("D:D"), WorksheetFunction.Match(WorksheetFunction.Max(Range("D:D")), Range("D:D"), 0)).Row

Range(Cells(fRow, 10), Cells(lRow, 10)).Copy Range(Cells(fRow, 19).Address)
Range(Cells(fRow, 13), Cells(lRow, 13)).Copy Range(Cells(fRow, 18).Address)




Application.CutCopyMode = False [COLOR=#333333]End Sub[/COLOR]
 
Upvote 0
Ok so just need to adjust the columns a bit

Try this

Code:
[COLOR=#333333]Sub Scapf2nacodfamifc()
[/COLOR]Dim fRow As Long
Dim lRow As Long

lRow = Cells(Rows.Count, 10).End(xlUp).Row
fRow = WorksheetFunction.Index(Range("D:D"), WorksheetFunction.Match(WorksheetFunction.Max(Range("D:D")), Range("D:D"), 0)).Row

Range(Cells(fRow, 10), Cells(lRow, 10)).Copy Range(Cells(fRow, 19).Address)
Range(Cells(fRow, 13), Cells(lRow, 13)).Copy Range(Cells(fRow, 18).Address)




Application.CutCopyMode = False [COLOR=#333333]End Sub[/COLOR]

many thanks :)
Brill
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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