Range into dynamic

Jolenelity

New Member
Joined
Jun 3, 2013
Messages
6
Hi! This is the codes which I'm currently working on. Just wondering how can I make the range (highlighted in red) into dynamic range such that all the data will be captured no matter the number of rows there are.

ActiveSheet.Range("$A$1:$AH$995").AutoFilter Field:=21, Criteria1:="=FH*", Operator:=xlFilterValues
Cells.Select
Range("F1").Activate
Selection.Copy
Sheets.Add After:=Sheets(Sheets.Count)
Sheets("Sheet1").Name = "Residential Raw"
ActiveSheet.Paste

Sheets("Raw").Select
Application.CutCopyMode = False
ActiveSheet.Range("$A$1:$AH$995").AutoFilter Field:=21, Criteria1:="FB*", Operator:=xlFilterValues
Selection.Copy
Sheets.Add After:=Sheets(Sheets.Count)
Sheets("Sheet2").Name = "Business Raw"
ActiveSheet.Paste
Range("I18").Select

Thanks! :)
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi, just one more question... For this codes: The one which is highlighted in red, how can I make it to dynamic range too?

Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Residential Raw!R1C1:R659C34", Version:=xlPivotTableVersion14). _
CreatePivotTable TableDestination:="Sheet1!R3C1", TableName:="PivotTable6" _
, DefaultVersion:=xlPivotTableVersion14

Thank you!​
 
Upvote 0
Code:
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
    "Residential Raw!" & Sheets("Residential Raw").Range("A1").CurrentRegion.Address(0, 0, xlR1C1), _
    Version:=xlPivotTableVersion14).CreatePivotTable TableDestination:="Sheet1!R3C1", _
    TableName:="PivotTable6", DefaultVersion:=xlPivotTableVersion14
 
Upvote 0

Forum statistics

Threads
1,215,456
Messages
6,124,939
Members
449,197
Latest member
k_bs

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