Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I repeat key strokes in Excel?
I tried recording the following macro.
F2 - Select current cell Shift arrow left backspace - (to delete one character) shirt arrow left backspace - (to delect one character) enter - which advance to next cell down. instead the macro records the value that I was working with after the 2 backspaces, instead I want it to perform the key strokes as entered. Please help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I repeat key strokes in Excel?
With ActiveCell .Value = Left(.Value, Len(.Value) - 1) .Offset(0, -1).Value = Left(.Offset(0, -1).Value, Len(.Offset(0, -1).Value) - 1) .Offset(1, -1).Select End With -- HTH RP (remove nothere from the email address if mailing direct) "ross_76102" wrote in message ... I tried recording the following macro. F2 - Select current cell Shift arrow left backspace - (to delete one character) shirt arrow left backspace - (to delect one character) enter - which advance to next cell down. instead the macro records the value that I was working with after the 2 backspaces, instead I want it to perform the key strokes as entered. Please help. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I repeat key strokes in Excel?
What are you trying to do?
-- Don Guillett SalesAid Software "ross_76102" wrote in message ... I tried recording the following macro. F2 - Select current cell Shift arrow left backspace - (to delete one character) shirt arrow left backspace - (to delect one character) enter - which advance to next cell down. instead the macro records the value that I was working with after the 2 backspaces, instead I want it to perform the key strokes as entered. Please help. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I repeat key strokes in Excel?
Ross,
You can't record or code keystrokes to edit a cell. This truncates the two cells to the left of the active cell, stripping the rightmost character: Sub test() With ActiveCell.Offset(0, -1) .Value = Left$(.Value, Len(.Value) - 1) End With With ActiveCell.Offset(0, -2) .Value = Left$(.Value, Len(.Value) - 1) End With End Sub hth, Doug "ross_76102" wrote in message ... I tried recording the following macro. F2 - Select current cell Shift arrow left backspace - (to delete one character) shirt arrow left backspace - (to delect one character) enter - which advance to next cell down. instead the macro records the value that I was working with after the 2 backspaces, instead I want it to perform the key strokes as entered. Please help. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I repeat key strokes in Excel?
Here is some code to do what you have ascked...
Public Sub TrimLast2() With ActiveCell If Len(.Value) = 2 Then .Value = Left(.Value, Len(.Value) - 2) .Offset(1, 0).Select End If End With End Sub HTH "ross_76102" wrote: I tried recording the following macro. F2 - Select current cell Shift arrow left backspace - (to delete one character) shirt arrow left backspace - (to delect one character) enter - which advance to next cell down. instead the macro records the value that I was working with after the 2 backspaces, instead I want it to perform the key strokes as entered. Please help. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I repeat key strokes in Excel?
"ross_76102" wrote: I tried recording the following macro. F2 - Select current cell Shift arrow left backspace - (to delete one character) shirt arrow left backspace - (to delect one character) enter - which advance to next cell down. instead the macro records the value that I was working with after the 2 backspaces, instead I want it to perform the key strokes as entered. Please help. You'll need a macro for this. If I understand you correctly, you may be able to use something like this ... sub takeoffmyval() dim c as range, s as range set s = selection for each c in s c.value = trim(left(c.value, len(c.value) - 2)) next end sub Note this takes some assumptions into hand. Save your work before running. To run: From Excel press Alt + F11. Press Ctrl + R Select (Bold) file on left pane. Select Insert (menu) | Module Copy/Paste code above on right pane. Alt + Q will return to Excel. Ctrl + S will Save your workbook. Alt + F8 will bring up the Macro dialog box. Select 'takeoffmyval'. Click Run. HTH |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
How do I repeat key strokes in Excel?
If you are just wanting to remove the last two characters from a field you
could use a formula like this: =LEFT(A2,LEN(A2)-2) Or if you want to do it via a macro this will do the same thing: activecell.value = left(activecell.Value,len(activecell.Value)-2) Hope this helps Rowan "ross_76102" wrote: I tried recording the following macro. F2 - Select current cell Shift arrow left backspace - (to delete one character) shirt arrow left backspace - (to delect one character) enter - which advance to next cell down. instead the macro records the value that I was working with after the 2 backspaces, instead I want it to perform the key strokes as entered. Please help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
what are the keyboard strokes to reveal formulas in a worksheet? | Excel Worksheet Functions | |||
Slow Respone to key strokes | Excel Discussion (Misc queries) | |||
Slow respone to key strokes | Excel Discussion (Misc queries) | |||
Is there a way to move between worksheets using key strokes only? | Excel Discussion (Misc queries) | |||
How can I activate a combobox by keyboard strokes ? | Excel Programming |