Hello,

it's my file Excel :

10      "Limousin"
11      "Lorraine"
12      "Midi-Pyrénées"
13      "Nord-Pas de Calais"
14      "Basse Normandie"
15      "Haute Normandie"
16      Pays de la loire
17      "Picardie"
18      "Poitou-Charentes"
19      "Provence-Alpes-Côte d'Azur"
20      "Rhone-Alpes"
21      "Corse"
22      "Outre Mer et Etranger"

and it's my script :

require 'watir'
require 'win32ole'

puts "Choisir Region

10=Limousin
11=Lorraine
12=Midi-Pyrenees
13=Nord-Pas de Calais
14=Basse Normandie
15=Haute Normandie
16=Pays de la loire
17=Picardie
18=Poitou-Charentes
19=Provence-Alpes-Cote d'Azur
20=Rhone-Alpes
21=Corse
22=Outre Mer et Etranger
?"
region=gets # I ask to enter a number between 10 to 22

excel = WIN32OLE::new('excel.Application')
excel.DisplayAlerts = false
excel.Visible = 1
workbook = excel.Workbooks.Open('C:\Ruby191\rv.xls')

for i in 1 .. workbook.Worksheets.Count

  worksheet = workbook.Worksheets(i)
   rowcount = worksheet.UsedRange.Rows.Count
  for j in 1..rowcount

num =worksheet.Cells(j, 1).value
nu=num.round(0)

if nu=region

puts worksheet.Cells(j, 2).value

end
end
end


with that script it array all worksheet.Cells(j, 2).value, I don't
know how to array only worksheet.Cells(j, 2).value where nu=region


Do you have an idea?

thx

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to