Copy paste rows within array

cooolboy

Board Regular
Joined
Apr 6, 2006
Messages
55
I would like to copy and paste the last row of array (i.e duplicating last row). please guide me with a code.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
You may need to explain your question/request a little bit more to get a better answer. The below should assist you though.

Code:
Sub example_go()


    LastRow = Range("A" & Rows.Count).End(xlUp).Row
    Range("A" & LastRow).Copy
    Range("A" & LastRow).Offset(1, 0).PasteSpecial
    


End Sub
 
Upvote 0
Code:
LR=Range("A" & Rows.count).end(xlup).row
Range("A" & LR & ":XFD" & LR).Offset(1,0).value=Range("A" & LR & ":XFD" & LR).Value
 
Upvote 0
I am populating an array (2 dimension) manually using VBA code. i would like to duplicate the last row array. see below my code but I would like to know other one line code if any for this...


Set userange = Range("mytable")


For i = 1 To 14

For y = 1 To 30

IF userange(i,2).value = "NOSHOW" THEN

'Duplicate the previous array row (Is There any one line code to duplicate the last row of array instead of using FOR Next Loop)


For z=1 to 30
Array(i,z) = MyArray (i-1, z).value
Next
EXIT FOR

ELSE

MyArray(i, y) = userange (i, y).value


ENDIF

Next


Next
 
Upvote 0

Forum statistics

Threads
1,213,520
Messages
6,114,099
Members
448,548
Latest member
harryls

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