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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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.
 
Upvote 0
If you're editing text in a cell, try something like this...

Code:
With ActiveCell
    .Value = Left(.Value, Len(.Value) - 1)
End With
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,194
Members
449,072
Latest member
DW Draft

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
Back
Top