Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Editing text

WinXP Excel 2003
Is it possible to programmicatically determine the position of the Cursor in
a text string in a cell - eg as a count to the Right from the 1st character
in the cell?

Also, I have a macro which places a Tab code [Chr(9)] in a string.
If I then try to manually edit the text (double click the cell), I see that
the Cursor has been tabbed ok, but any text I then enter ignores the tab and
is placed immediately after the last character in the string.
Is there any way to overcome this.

donwb
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Editing text

First put data in a cell (either with VBA or manually).
Next double-click the cell.

If you double-click near the right boundary of the cell, the edit cursor
will appear near the end of the data. If you double-click near the left
boundary of the cell, the edit cursor will appear near the beginning of the
data.

You can, from VBA, programmatically enter edit mode in a cell with the edit
cursor exactly positioned, but it requires SendKeys (which many prudent
people avoid).
--
Gary''s Student - gsnu200770


"donbowyer" wrote:

WinXP Excel 2003
Is it possible to programmicatically determine the position of the Cursor in
a text string in a cell - eg as a count to the Right from the 1st character
in the cell?

Also, I have a macro which places a Tab code [Chr(9)] in a string.
If I then try to manually edit the text (double click the cell), I see that
the Cursor has been tabbed ok, but any text I then enter ignores the tab and
is placed immediately after the last character in the string.
Is there any way to overcome this.

donwb

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Editing text

There are several ways to handle the first question. Look up the Mid, Left,
Right and Characters functions in VBA help.

I don't quite understand your second problem, except that cell edititing has
certain protocol.

"donbowyer" wrote:

WinXP Excel 2003
Is it possible to programmicatically determine the position of the Cursor in
a text string in a cell - eg as a count to the Right from the 1st character
in the cell?

Also, I have a macro which places a Tab code [Chr(9)] in a string.
If I then try to manually edit the text (double click the cell), I see that
the Cursor has been tabbed ok, but any text I then enter ignores the tab and
is placed immediately after the last character in the string.
Is there any way to overcome this.

donwb

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 107
Default Editing text

Thanks for the responses.
First Q.
So what is the correct syntax for something like
MyPosition=ActiveCell.CursorPosition
mindful that the cell will, by definition, have to be in the Edit mode.
Second Q.
The macro I discussed Tabs the Cursor from the last character in the cell to
a position just right of the last character. That's fine.
When the macro's finished, a DoubleClick on the cell clearly shows the new
Cursor position. But if I then enter new text, then hit Return, the new text
is not at the Tabbed Cursor position, but back to just after the original
text's last character.

--
donwb


"JLGWhiz" wrote:

There are several ways to handle the first question. Look up the Mid, Left,
Right and Characters functions in VBA help.

I don't quite understand your second problem, except that cell edititing has
certain protocol.

"donbowyer" wrote:

WinXP Excel 2003
Is it possible to programmicatically determine the position of the Cursor in
a text string in a cell - eg as a count to the Right from the 1st character
in the cell?

Also, I have a macro which places a Tab code [Chr(9)] in a string.
If I then try to manually edit the text (double click the cell), I see that
the Cursor has been tabbed ok, but any text I then enter ignores the tab and
is placed immediately after the last character in the string.
Is there any way to overcome this.

donwb

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing Text Help Excel Discussion (Misc queries) 4 October 22nd 07 07:24 PM
Moving a shape with text inside without editing text Dan Excel Programming 3 March 10th 07 11:33 PM
Editing text in text box grouped within a trapezoid Linking to specific cells in pivot table Excel Programming 11 August 16th 05 09:17 AM
Possible too - ADD Text While editing a cell thom hoyle Excel Programming 3 June 11th 05 06:44 PM
Editing text file Foss Excel Programming 3 June 3rd 04 02:27 PM


All times are GMT +1. The time now is 09:20 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"