Trying to remove the last character from some text.

pglufkin

Board Regular
Joined
Jun 19, 2005
Messages
127
I am trying to remove the last character from some text with:

Application.SendKeys "{F2}"
Application.SendKeys "{BS}"
Application.SendKeys "{Enter}"

But when I do this, it is giving me the object browser in VBE . . . can anyone help?
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

pglufkin

Board Regular
Joined
Jun 19, 2005
Messages
127
Weird, I have the same, Windows 7, Excel 2007. I am debugging and starting from my worksheet I step into it, but when I get to sendkeys F2, it somehow thinks it is in the VBE and brings up the object browser.
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,402
If you're editing text in a cell, try something like this...

Code:
With ActiveCell
    .Value = Left(.Value, Len(.Value) - 1)
End With
 

pglufkin

Board Regular
Joined
Jun 19, 2005
Messages
127
Ok, got it, thank you.

I don't think stepping into procedures while analyzing code and using sendkeys are compatible.

Would that make sendkeys an inferior programming technique? I am thinking so.
 

Watch MrExcel Video

Forum statistics

Threads
1,130,119
Messages
5,640,219
Members
417,131
Latest member
Seanr19871

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top