Microsoft Excel – Usage of `Remove Duplicates`

There isn’t much about remove duplicates in scripts dictionary. How to use this since it doesn’t seem to work specifying only the selected range after remove duplicates in Microsoft Excel

In windows/VBA version it also expects a column input

image

I think the OP was asking about Word, though they didn’t say so.

Sorry that was on Microsoft Excel

Works fine for me. You should include your code so that people can see what you’re doing.

This will fill in some data in a few cells and then remove the duplicate values. Finally, it returns a list of the updated, unique values.

tell application "Microsoft Excel"
	with timeout of 3 seconds
		
		-- enter data
		set sr to range ("A1:A7") -- initial range
		set vList to {{4}, {5}, {6}, {7}, {5}, {4}, {3}} -- initial data
		set value of sr to vList
		delay 2 -- allow time to view data
		
		remove duplicates sr
		
		-- get list of unique data
		set xList to {}
		set nr to range (get address of current region of cell "A1")
		set cnr to cells of nr
		
		repeat with vv from 1 to count of cnr
			set end of xList to (get value of item vv of cnr as integer)
		end repeat
		xList
		--> {4, 5, 6, 7, 3}
		
	end timeout
end tell

No this doesn’t reflect in the GUI of Excel