Making ranges in a macro dynamic?

sadia1991

New Member
Joined
Aug 10, 2014
Messages
11
Hello!

This is the macro I have recorded:
Rich (BB code):
Range("A1:G1").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlDown)).Select
    Range("A1:G212").Select
    Selection.Copy
    Windows("arrangement.xlsx").Activate
    Range("A1").Select
    ActiveSheet.Paste
    Range("L1:L55").Select
    Application.CutCopyMode = False
    Selection.Copy
    Windows("MINING.xlsx").Activate
    Range("RA73:RA127").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Windows("!2014-05-15 experiment").Activate
    Application.CutCopyMode = False
    Selection.Delete Shift:=xlUp
    Range("A1").Select
End Sub
How do I make the ranges in red (above) dynamic?
for the line Range("A1:G212").Select I was trying to select a block of cells (which I can do by pressing ctrl + A and then shift+down arrow OR ctrl+shift+down 12 times then shift+up arrow once)

for the line Range("RA73:RA127").Select I was trying to select a block of cells adjacent to the cell already active in the sheet (the idea is that I would paste a block of cells then repeat the macro and the next block of cells would get pasted in the next column etc.)


Thank you for taking the time to read and respond to my question! Any help is greatly appreciated!
 
Last edited by a moderator:

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,223,248
Messages
6,171,021
Members
452,374
Latest member
keccles

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