filter more than 2 name in one column for excel(applescript)

Hi All,

I’m newly studying applescript and I understood how to fiter 2 name in one column by applescript. Example like below.

Excel format:

Name 1day 2day 3day
AB01 4 745 98
AB02 441 1456 5
AB03 5 1236 43
AB04 66 24 123
AB0A 124 123 6
AB0B 6 56 3
AB0C 6 234 4
AB0D 1 1 1
AB0E 61 4 2

The script I wote below to filter 2 Name “AB01” and “AB02” and it works well:

tell application "Microsoft Excel"
  activate
 
 
          set RG_Row_2 to range "1:1"
          set filtername to get first column index of (find (RG_Row_2) what "Name")
          set LastColumn_Index to text 2 of (get address of (get offset of (get end range "A1" direction toward the right) column offset 1)) as text
          set Working_Range to range ("A:" & LastColumn_Index)
 
  autofilter range Working_Range field filtername criteria1 "AB01" operator autofilter or criteria2 "AB02"
 
 
end tell

Could anyone help me on how to filter more than 2 Name like “AB0A”, “AB0B”, “AB0C”,“AB0D”. If I use AB*, it will include

all date which I do not expect.

And I try use advanced filter, however, it does not work well. Example below just can filter one name “AB0A”. Could anyone help on it? Thanks.

tell application "Microsoft Excel"
  activate
 
 
          set RG_Row_2 to range "1:1"
          set filtername to get first column index of (find (RG_Row_2) what "Name")
          set LastColumn_Index to text 2 of (get address of (get offset of (get end range "A1" direction toward the right) column offset 1)) as text
          set Working_Range to range ("A:" & LastColumn_Index)
 
 
          set value of range "G1:G5" to {{"Name"}, {"=\"= AB0A\""}, {"=\"= AB0B\""}, {"=\"= AB0C\""}, {"=\"= AB0D\""}}
  advanced filter Working_Range action filter in place criteria range "G1:G5"
 
 
end tell

AppleScript: 2.5
Browser: Safari 536.26.17
Operating System: Mac OS X (10.8)

Hi All,

I have fixed the script and work perfect. Have anyone got another way to filter these 4 names rather than add one column G to filter. Thanks.

tell application "Microsoft Excel"
	activate
	
	
	set RG_Row_2 to range "1:1"
	set filtername to get first column index of (find (RG_Row_2) what "Name")
	set LastColumn_Index to text 2 of (get address of (get offset of (get end range "A1" direction toward the right) column offset 1)) as text
	set Working_Range to range ("A:" & LastColumn_Index)
	
	
	set value of range "G1:G5" to {{"Name"}, {"=\"=AB0A\""}, {"=\"=AB0B\""}, {"=\"=AB0C\""}, {"=\"=AB0D\""}}
	advanced filter Working_Range action filter in place criteria range "G1:G5"
	
	
end tell