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.
 

thatmichaelguy

New Member
Joined
Jan 27, 2015
Messages
9
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
 

Blade Hunter

Well-known Member
Joined
Mar 13, 2008
Messages
3,147
Code:
LR=Range("A" & Rows.count).end(xlup).row
Range("A" & LR & ":XFD" & LR).Offset(1,0).value=Range("A" & LR & ":XFD" & LR).Value
 

cooolboy

Board Regular
Joined
Apr 6, 2006
Messages
55
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
 

Forum statistics

Threads
1,086,096
Messages
5,387,806
Members
402,077
Latest member
excelinedinburgh

Some videos you may like

This Week's Hot Topics

Top