AHK: Excel_Autofilter

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
inseption86
Posts: 205
Joined: 19 Apr 2018, 00:24

AHK: Excel_Autofilter

24 Feb 2019, 07:55

Hi guys, help me please, how to get value from the second line after the filter

Code: Select all

xl.Worksheets(1).Range("A1:AF1").AutoFilter(7, "eng")
Lang := xl.Worksheets(1).AutoFilter.Range.Columns("E").SpecialCells(12).row + 1.value ???????

User avatar
Datapoint
Posts: 296
Joined: 18 Mar 2018, 17:06

Re: AHK: Excel_Autofilter

24 Feb 2019, 12:14

inseption86 wrote:
24 Feb 2019, 07:55

Code: Select all

Lang := xl.Worksheets(1).AutoFilter.Range.Columns("E").SpecialCells(12).row + 1.value ???????
SpecialCells returns a Range object, so you should be able to use Range.Offset like this:

Code: Select all

Lang := xl.Worksheets(1).AutoFilter.Range.Columns("E").SpecialCells(12).Offset(1, 0).Value
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: AHK: Excel_Autofilter

24 Feb 2019, 13:09

I think you have to loop through visible cells

Code: Select all

for c in xl.Worksheets(1).AutoFilter.Range.Columns("E").SpecialCells(12)
{
	if A_Index = 2 				; second row after title
	{
		MsgBox % c.address " = " c.value
		break
	}
}
inseption86
Posts: 205
Joined: 19 Apr 2018, 00:24

Re: AHK: Excel_Autofilter

25 Feb 2019, 01:25

Datapoint wrote:
24 Feb 2019, 12:14
inseption86 wrote:
24 Feb 2019, 07:55

Code: Select all

Lang := xl.Worksheets(1).AutoFilter.Range.Columns("E").SpecialCells(12).row + 1.value ???????
SpecialCells returns a Range object, so you should be able to use Range.Offset like this:

Code: Select all

Lang := xl.Worksheets(1).AutoFilter.Range.Columns("E").SpecialCells(12).Offset(1, 0).Value
Thank you

Code: Select all

MsgBox % xl.Worksheets(1).AutoFilter.Range.Offset(1, 0).Columns("E").SpecialCells(12).value)
But, if i have two and three row, this is

Code: Select all

MsgBox % xl.Worksheets(1).AutoFilter.Range.Offset(2, 0).Columns("E").SpecialCells(12).row
not working

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], jeves, Joey5, matt101, Thorlian and 159 guests