Add a Char to the current cell

H

Harish Shinde

hi,

I have a custom commandbutton. On click of this commandbutton I need to add a Char '@' to the current cursor location on the Excel Sheet. While using range Interop object I m able to replace the current cell data with the above char but I need to append it.

Could anyone help me please :))

Thanks in Advance...

-Harish Shinde
 
C

CLR

Sub AppendSelectedCell()
Dim rng
rng = Selection.Value
Selection = rng & "@"
End Sub

Vaya con Dios,
Chuck, CABGx3



hi,

I have a custom commandbutton. On click of this commandbutton I need to add a Char '@' to the current cursor location on the Excel Sheet. While using range Interop object I m able to replace the current cell data with the above char but I need to append it.

Could anyone help me please :))

Thanks in Advance...

-Harish Shinde
 
H

Harish Shinde

I tried but Selection Object in C# is a readonly

here is my lines of code
----------------------------------------------------------------
object rng;

Microsoft.Office.Interop.Excel._Application appXl = (Microsoft.Office.Interop.Excel._Application)applicationObject.GetType().InvokeMember("Application", BindingFlags.GetProperty, null, applicationObject, null);

rng = appXl.Selection;

appXl.Selection = rng & "@";

---------------------------------------------------------------------------------------------------------------------------------------------------

-Harish Shinde

Sub AppendSelectedCell()
Dim rng
rng = Selection.Value
Selection = rng & "@"
End Sub

Vaya con Dios,
Chuck, CABGx3



hi,

I have a custom commandbutton. On click of this commandbutton I need to add a Char '@' to the current cursor location on the Excel Sheet. While using range Interop object I m able to replace the current cell data with the above char but I need to append it.

Could anyone help me please :))

Thanks in Advance...

-Harish Shinde
 
H

Harish Shinde

I tried with Value2 it is adding the char on entire cell ...but not adding in-between while editing the current cell..

Any help is appreciated...

Thanks,

-Harish Shinde
I tried but Selection Object in C# is a readonly

here is my lines of code
----------------------------------------------------------------
object rng;

Microsoft.Office.Interop.Excel._Application appXl = (Microsoft.Office.Interop.Excel._Application)applicationObject.GetType().InvokeMember("Application", BindingFlags.GetProperty, null, applicationObject, null);

rng = appXl.Selection;

appXl.Selection = rng & "@";

---------------------------------------------------------------------------------------------------------------------------------------------------

-Harish Shinde

Sub AppendSelectedCell()
Dim rng
rng = Selection.Value
Selection = rng & "@"
End Sub

Vaya con Dios,
Chuck, CABGx3



hi,

I have a custom commandbutton. On click of this commandbutton I need to add a Char '@' to the current cursor location on the Excel Sheet. While using range Interop object I m able to replace the current cell data with the above char but I need to append it.

Could anyone help me please :))

Thanks in Advance...

-Harish Shinde
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top