I will have multiple rows of some string of text, might be email addresses or part numbers.
I want to be able to add text around the values in those cells and store all the new text in the clipboard (for pasting into SQL).
Below would be the rows of data from Excel:
PN1
PN2
PN3
PN4
Copy those cells to the clipboard, run script, and output:
or PN like 'PN1'
or PN like 'PN2'
or PN like 'PN3'
or PN like 'PN4'
Add the same bit of text to multiple cells taken from Excel
Re: Add the same bit of text to multiple cells taken from Excel
Code: Select all
XL := ComObjActive("excel.application"), str := ""
For c in XL.Selection ; Loop through selected cells
str .= (A_Index = 1 ? "" : "`n") "or PN like '" c.text "'"
MsgBox, 64, Result, %str%