Range("AR65536").End(xlUp).Offset(-7).Select question

redspanna

Well-known Member
Joined
Jul 27, 2005
Messages
1,604
Office Version
  1. 365
Platform
  1. Windows
Hi all

here is what I'm trying to achieve...

Sheet "sheet1"
Find last populated cell in column AR
move up 7 rows
copy AR:AX 7 rows of data
Find last populated cell in column AR..down 1 (ie blank cell)
paste copied AR:AX cells

example...

AR100 is last populated cell
so move upto AR93
copy AR93:AX100
move back to AR100
Down one row
paste AR93:AX100

I'm getting stuck with the X1up and ranges to copy etc so any help appreciated
thanks
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Try

Code:
Sheets("Sheet1").Range("AR" & Rows.Count).End(xlUp).Offset(-6).Resize(7, 6).Copy Destination:=Sheets("Sheet1").Range("AR" & Rows.Count).End(xlUp).Offset(1)
 
Upvote 0
To get the results you indicate try this.
Code:
Dim rngEnd As Range
 
Set rngEnd = Worksheets("Sheet1").Cells(Rows.Count, "AR").End(xlUp)
 
rngEnd.Offset(-7).Resize(8, 7).Copy rngEnd.Offset(1)

You'll notice though that it doesn't quite match your initial directions.

Probably just me getting mixed up though.:)
 
Last edited:
Upvote 0
Hi there,

Try this:

Code:
Sub test()
    Dim lRow, lRowOffset, blankRow As Double
    
    lRow = Range("AR" & Application.Rows.Count).End(xlUp).Row
    lRowOffset = lRow - 7
    blankRow = lRow + 1
    Range("AR" & lRowOffset & ":AX" & lRowOffset).Copy Destination:=Range("AR" & blankRow)
End Sub
 
Upvote 0
redspanna,


Sample data before the macro code:


Excel Workbook
ARASATAUAVAWAX
9292929292929292
9393939393939393
9494949494949494
9595959595959595
9696969696969696
9797979797979797
9898989898989898
9999999999999999
100100100100100100100100
101
102
103
104
105
106
107
108
109
Sheet1





After the macro code:


Excel Workbook
ARASATAUAVAWAX
9292929292929292
9393939393939393
9494949494949494
9595959595959595
9696969696969696
9797979797979797
9898989898989898
9999999999999999
100100100100100100100100
10193939393939393
10294949494949494
10395959595959595
10496969696969696
10597979797979797
10698989898989898
10799999999999999
108100100100100100100100
109
Sheet1





Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).


Code:
Sheets("Sheet1").Range("AR" & Rows.Count).End(xlUp).Offset(-7).Resize(8, 7).Copy Destination:=Sheets("Sheet1").Range("AR" & Rows.Count).End(xlUp).Offset(1)
 
Upvote 0
Guys,

thank you all so much really appreciate your help

:)
 
Upvote 0

Forum statistics

Threads
1,224,598
Messages
6,179,814
Members
452,945
Latest member
Bib195

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