ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   do a `down arrow' (https://www.excelbanter.com/excel-programming/276881-do-%60down-arrow.html)

Larry Levinson

do a `down arrow'
 
Ok, I can't read ...

Dim year_start As Date, last_row As Integer
year_start = DateValue("1/1/" & Year(Date))
Range("a1").Activate

ActiveSheet.Range("A1").AutoFilter _
Field:=1, _
Criteria1:="<" & year_start

Application.SendKeys ("{DOWN}")

last_row = ActiveCell.row - 1
Selection.AutoFilter

why doesn't this sendkeys ... do a DOWN arrow?


Larry Levinson
Talking up to the vocal ...
LLevinson*Bloomberg.net
(remove the star etc ....)

Ronald Dodge

do a `down arrow'
 
Two things I see. First, Activate is for the Workbook and Worksheet level
while Select is for the range level. Therefore, replace your
Range("a1").Activate to Range("A1").Select. I have ran into issues in the
past of Activate not working properly on range objects.

Now, if all you want to do is move the activecell down 1 row, the Offset
Method would do the trick for you.

ActiveCell.Offset(1,0).Select

--
Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
"Larry Levinson" wrote in message
...
Ok, I can't read ...

Dim year_start As Date, last_row As Integer
year_start = DateValue("1/1/" & Year(Date))
Range("a1").Activate

ActiveSheet.Range("A1").AutoFilter _
Field:=1, _
Criteria1:="<" & year_start

Application.SendKeys ("{DOWN}")

last_row = ActiveCell.row - 1
Selection.AutoFilter

why doesn't this sendkeys ... do a DOWN arrow?


Larry Levinson
Talking up to the vocal ...
LLevinson*Bloomberg.net
(remove the star etc ....)





All times are GMT +1. The time now is 06:58 AM.

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