1
0
ExcelAddIn/Tools/Button2Tool.cs
2023-06-14 15:23:33 +03:00

30 lines
518 B
C#

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)
{
}
}