Pregunta

¿Es posible mostrar la información de la celda cuando se hace clic en cualquier celda de una hoja de trabajo? Por ejemplo, si se hace clic en la celda A1, mostrará A1, y así sucesivamente ... En caso afirmativo, ¿puede mostrar un ejemplo?

Necesito esto porque tengo un programa de C # que debería saber en qué celda se hizo clic.

¿Fue útil?

Solución

Debe usar el evento WorksheetSelectionChange , hay un código de muestra en MSDN - http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.worksheet.selectionchange.aspx

private void WorksheetSelectionChange()
{
this.SelectionChange += 
    new Excel.DocEvents_SelectionChangeEventHandler(
    Worksheet1_SelectionChange);
}

void Worksheet1_SelectionChange(Excel.Range Target)
{
this.Application.StatusBar = this.Name + ":" +
    Target.get_Address(missing, missing,
    Excel.XlReferenceStyle.xlA1, missing, missing);
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top