You need to check the MSDN documentation of UsedRange Property
. Also see the 56 Excel ColorIndex Colors to verify the color index of yellow
. Look this also Change cell background color using VBA .
I use the Excel sheet as below :
Here is the code :
require 'win32ole'
# create an instance of the Excel application object
excel = WIN32OLE.new('Excel.Application')
# make Excel visible
excel.visible = true
# open the excel from the desired path
wb=excel.workbooks.open("C:\\Users\\test.xlsx")
# get the first Worksheet
wbs= wb.worksheets(1)
# fill the column with a specific coloe
wbs.usedrange.interior.colorindex = 6