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

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().

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,450
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.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,292
Messages
5,836,451
Members
430,431
Latest member
Tomexcel2022

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