Selecting a range with variables

ebetke

New Member
Joined
Apr 4, 2007
Messages
17
One of our key data sources is a cube. I connect to the cubeto pull data into a pivot table and then clean up the table so that it is in table format. I want to copy the table and paste it to another tab as values then run through the clean up of the headers and first two columns. Since the tables vary in size, I want to use variables for the range selection. Selct down to last row and last column. I cannot figure it out. I used the recorder to get most of the other code and just need help identifying the ranges to be modified. Here is what I recorded and this is the piece I want to be variable - Range("A10:C271").Select.


Range("C10").Select
Range(Selection, Selection.End(xlDown)).Select
Range("A10:C271").Select
Range("C10").Activate
Selection.SpecialCells(xlCellTypeBlanks).Select
Application.CutCopyMode = False
Selection.FormulaR1C1 = "=R[-1]C"

Thanks for your help!
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Start at the top right side of the pivot table (so it will select all the way down, and not hit any blanks).

Range(ActiveCell, ActiveCell.End(xlDown)).Select

Then move to the left until you select the entire table.
 
Upvote 0

Forum statistics

Threads
1,224,595
Messages
6,179,798
Members
452,943
Latest member
Newbie4296

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