ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Variable in RANGE (https://www.excelbanter.com/excel-programming/296277-using-variable-range.html)

Jim[_31_]

Using Variable in RANGE
 
In a macro I calculate the number of rows and assign it
to 'TOTACS'. I then try and use TOTACS in a Range
statement but it will not let me. How do I go about doing
this? Below is my code:

totacs = dmclastrow + authlastrow

Range("A2").Select

Range("A1:"totacs).AdvancedFilter
Action:=xlFilterCopy, CopyToRange:= _
Columns("G:H"), Unique:=True

Frank abel

Using Variable in RANGE
 
Hi
try
Range("A1:" & totacs).AdvancedFilter

-----Original Message-----
In a macro I calculate the number of rows and assign it
to 'TOTACS'. I then try and use TOTACS in a Range
statement but it will not let me. How do I go about

doing
this? Below is my code:

totacs = dmclastrow + authlastrow

Range("A2").Select

Range("A1:"totacs).AdvancedFilter
Action:=xlFilterCopy, CopyToRange:= _
Columns("G:H"), Unique:=True
.


Bob Phillips[_6_]

Using Variable in RANGE
 

Range("A1:A" & totacs).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=
_
Columns("G:H"), Unique:=True

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jim" wrote in message
...
In a macro I calculate the number of rows and assign it
to 'TOTACS'. I then try and use TOTACS in a Range
statement but it will not let me. How do I go about doing
this? Below is my code:

totacs = dmclastrow + authlastrow

Range("A2").Select

Range("A1:"totacs).AdvancedFilter
Action:=xlFilterCopy, CopyToRange:= _
Columns("G:H"), Unique:=True





All times are GMT +1. The time now is 04:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com