Thank you for helping me out. I'm trying to change cell N that contains the subcategory of a music track if it finds the track title I'm looking for in column R. (the same track titles appear multiple timex across the sheet and I can't modify the Excel to do a pivot table, and I can't add a macro either)
Code:
-- Declare variables
property searchTrackTitle : ""
property newSubCategory : ""
-- Display input box to get search term
display dialog "Enter the track title that you want to search for:" default answer ""
set searchTrackTitle to text returned of result
-- Display input box to get new SubCategory
display dialog "Enter the new SubCategory that you want to use:" default answer ""
set newSubCategory to text returned of result
-- Open Excel and set variables
tell application "Microsoft Excel"
activate
set sh to active sheet
set rng to range "R:R" of sh
end tell
-- Loop through each cell in the range
repeat with cell in rng
-- Check if the cell value matches the track title
if value of cell is searchTrackTitle then
-- Update the SubCategory for the track title
set (text of cell(("N") as text)) of sh to newSubCategory
end if
end repeat