行名と列名から取得したセルに値を入力する


おっさんですが、頑張ってます。添付サンプルファイルの例えばE3のセル番地にデータを入れたい場合に、Excelアプリケーションスコープ内に、「セルに書き込み」アクティビティや、データテーブル化したあとならば、代入を使って、(ヘッダーがある場合)Dt.rows(1).item(3)で入力できるかと思います。行名や列名で入力する方法はあるでしょうか?今回のケースでしたら、

行名:“3号ライン”
列名:“2021年”という文字列を含み、かつ、“2月”という文字列を含み、かつ、“可動率”という文字列を含む。

というロジックに致したいのです。試行錯誤を繰り返しているのですが、なかなかできません。ご教授いただければ幸いです。

尚、列名ですが、変数化する予定なので、“2021年”という文字列を含み、かつ、“2月”という文字列を含み、かつ、“可動率”という文字列を含む、という、少し冗長ですが、この様なロジックに致したいのです。宜しくお願い申し上げます。

aigahome

Hi @aigahome

Please try this,

dt.Rows(3).Item(dt.Columns.Cast(of datacolumn).where(function(col) col.columnname.tostring.tolower.trim.contains(“2021”) and col.columnname.tostring.tolower.trim.contains(“february”) and col.columnname.tostring.tolower.trim.contains(“operational availability”))(0))

Thanks

1 Like

great! perfect!
Thank you so much!

Could you professor me?
item以下の構文で、列の箇所は特定できました、rowの部分ですが、rows(3)ではなく、今回のケースでしたら、”3号ライン”という、行の表示名で取得できるでしょうか?

EX
dt.Rows(3)→?
dt.Rows(dt.Rows.Cast(of datarow).where(function(row) row.Rowname.tostring.tolower.trim.contains(“3号ライン”) )

これでは、エラーが出てしまい、構文ののものは間違っております。

Hi @aigahome

Sorry i couldn’t understand the question, what is the row name you are referring?

Thanks

I think the line name you are referring to will be “No3Line” in English.
MTKS

By the way, “No3Line” is an abbreviation for the machine in the factory used by our company.

@aigahome

Please correct me if am wrong,

  1. First we find the column name or index where it is equal to 2021, February and operational availability.

  2. So on that column we need to find the No3Line word and find the row number?..

Thanks

It is a work to put together a list of data that has been processed and confirmed externally.the data processed externally,there are multiple production lines such as No3Line and No12Line, so there are also multiple data. Even if the data is the same as February 2021, it will be multiple data because there are multiple production lines. Of course, if you connect the row number to each production line, you can paste the data in each cell, but I’m looking for a method that I think there is a way to paste it without connecting the row number in advance. I did. The method of getting the column name was very helpful. thank you. If you can’t find a method, we will process by associating the line number with each production line, so there is no problem. Sorry for the inconvenience.

MTKS

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.