From 7905d3af4d32405ef041de897bf2d23ee7d6d08e Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Wed, 14 Jun 2023 15:23:33 +0300 Subject: Add custom panel and tools --- Tools/Button2Tool.cs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Tools/Button2Tool.cs (limited to 'Tools/Button2Tool.cs') diff --git a/Tools/Button2Tool.cs b/Tools/Button2Tool.cs new file mode 100644 index 0000000..db7afc3 --- /dev/null +++ b/Tools/Button2Tool.cs @@ -0,0 +1,30 @@ +using Application = Microsoft.Office.Interop.Excel.Application; + +namespace ExcelAddIn.Tools; + +public class Button2Tool : Tool +{ + private readonly Application app; + public Button2Tool() + { + app = (Application)ExcelDnaUtil.Application; + } + public override void Execute() + { + if (app.ActiveCell == null) + { + return; + } + + double? cellValue = app.ActiveCell.Cells.Value2; + if (cellValue != null) + { + app.ActiveCell.Cells.Value2 = ++cellValue; + } + } + + protected override void Dispose(bool disposing) + { + + } +} \ No newline at end of file -- cgit v1.2.3