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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
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,216,526
Messages
6,131,187
Members
449,631
Latest member
mehboobahmad

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