Excelファイルの列や行を非表示にしたい

こんにちは。
Excelファイル(xlsxファイル等)で列や行を非表示にする操作を行いたいと思っております。
Invoke codeでVB.Netにて記載しようとしておりますが、記載方法がわかりません。

また、Invoke code以外でもできる方法がありましたらお教えください。
Excelを開いてショートカットキーを押下する方法は避けたいです。

以上、どうぞよろしくお願いいたします。

1 Like

こんにちは。
You can use activity in this package

Or try Invode VB code

Hope it help!

2 Likes

Thank you!!
I’ll try it.

1 Like

sorry that I can’t find my exit code, I have this step code, calling Vb code works fine, hope it can help you!

Thank you.
Is this VBA code?
I would like to know VB.Net code. Do you know it?

Hi Yamsakia san,

this video can help you
but have you tried the above package

1 Like

こんにちは

例えばClosedXMLなら以下になります。

image

Using wb As New ClosedXML.Excel.XLWorkbook(filename)
    Dim ws As ClosedXML.Excel.IXLWorksheet = wb.Worksheet(sheetName)
    ws.Rows(3,4).Hide()
    ws.Columns("C:D").Hide()
    wb.Save()
End Using

Sample
Sample20231114-4L.zip (8.6 KB)

2 Likes

Thank you.
I solved it that way.

1 Like

Happy automation Yamasakia san
cheer

1 Like

ClosedXMLでの方法を教えてくださりありがとうございます。
Interopを使うよりその方法のほうが良いかもしれませんね!

2 Likes

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