If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
How to insert an "X" in a selection of several cells?
Hello,
I would like to know how to insert an "X" in all cells selected in a table? I've tried this : Selection.TypeText Text:="X" But this code just put only one "X" in a selection of 6 cells !!! I'ld like to have a "X" in all 6 cells. These cells are to be selected a differents places in the table. Thanks for any advice. Jed |
#2
|
|||
|
|||
How to insert an "X" in a selection of several cells?
Dim oCell As Cell
For Each oCell In Selection.Range.Cells oCell.Range.Text = "X" Next oCell -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Jed" wrote in message ... Hello, I would like to know how to insert an "X" in all cells selected in a table? I've tried this : Selection.TypeText Text:="X" But this code just put only one "X" in a selection of 6 cells !!! I'ld like to have a "X" in all 6 cells. These cells are to be selected a differents places in the table. Thanks for any advice. Jed |
#3
|
|||
|
|||
How to insert an "X" in a selection of several cells?
Doug,
I also first made a solution like yours but I found that the Xs do not always end only where intended. For example, if you have 2 columns and select only cells in the second column, X's will also appear in the first column (all cells with an index number from the first in the selection to the last in the selection will be included). This does not happen if Selection.Cells is used instead of Selection.Range.Cells: Dim oCell As Cell For Each oCell In Selection.Cells oCell.Range.Text = "X" Next oCell -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "Doug Robbins - Word MVP" wrote: Dim oCell As Cell For Each oCell In Selection.Range.Cells oCell.Range.Text = "X" Next oCell -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Jed" wrote in message ... Hello, I would like to know how to insert an "X" in all cells selected in a table? I've tried this : Selection.TypeText Text:="X" But this code just put only one "X" in a selection of 6 cells !!! I'ld like to have a "X" in all 6 cells. These cells are to be selected a differents places in the table. Thanks for any advice. Jed |
#4
|
|||
|
|||
How to insert an "X" in a selection of several cells?
Doug/Lene,
I guess I read the post as the user wanted to put an "X" in each selected cell and those cells might be discontinuous selection. In which case neither method seems to work and I can't offer one that does :-( -- Greg Maxey/Word MVP See: http://gregmaxey.mvps.org/word_tips.htm For some helpful tips using Word. "Lene Fredborg" wrote in message ... Doug, I also first made a solution like yours but I found that the Xs do not always end only where intended. For example, if you have 2 columns and select only cells in the second column, X's will also appear in the first column (all cells with an index number from the first in the selection to the last in the selection will be included). This does not happen if Selection.Cells is used instead of Selection.Range.Cells: Dim oCell As Cell For Each oCell In Selection.Cells oCell.Range.Text = "X" Next oCell -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "Doug Robbins - Word MVP" wrote: Dim oCell As Cell For Each oCell In Selection.Range.Cells oCell.Range.Text = "X" Next oCell -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Jed" wrote in message ... Hello, I would like to know how to insert an "X" in all cells selected in a table? I've tried this : Selection.TypeText Text:="X" But this code just put only one "X" in a selection of 6 cells !!! I'ld like to have a "X" in all 6 cells. These cells are to be selected a differents places in the table. Thanks for any advice. Jed |
#5
|
|||
|
|||
How to insert an "X" in a selection of several cells?
Hello everyone
I'ld like to thanks everyone who response. I've tested both methods and now I'll continue working on it. I just want to do something simple and both works well in my case. So thanks to you all. I'm using : Dim oCell As Cell For Each oCell In Selection.Cells oCell.Range.Text = "X" Next oCell which works fine and I don't have any discontinous select. Thanks a lot to u all. My life is more easy now ;-) "Jed" wrote: Hello, I would like to know how to insert an "X" in all cells selected in a table? I've tried this : Selection.TypeText Text:="X" But this code just put only one "X" in a selection of 6 cells !!! I'ld like to have a "X" in all 6 cells. These cells are to be selected a differents places in the table. Thanks for any advice. Jed |
#6
|
|||
|
|||
How to insert an "X" in a selection of several cells?
Yes, it appears that Selection.Range.Cells is a range that commences with
the first selected cell and then includes every cell in the table between that cell and the last selected cell in the same way as the cells selection moves through the table by using the tab key. If the centre column of a 3 column table is selected, the X gets inserted into all of the cells except for the first one on the first row and the last one on the last row. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Lene Fredborg" wrote in message ... Doug, I also first made a solution like yours but I found that the Xs do not always end only where intended. For example, if you have 2 columns and select only cells in the second column, X's will also appear in the first column (all cells with an index number from the first in the selection to the last in the selection will be included). This does not happen if Selection.Cells is used instead of Selection.Range.Cells: Dim oCell As Cell For Each oCell In Selection.Cells oCell.Range.Text = "X" Next oCell -- Regards Lene Fredborg DocTools - Denmark www.thedoctools.com Document automation - add-ins, macros and templates for Microsoft Word "Doug Robbins - Word MVP" wrote: Dim oCell As Cell For Each oCell In Selection.Range.Cells oCell.Range.Text = "X" Next oCell -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Jed" wrote in message ... Hello, I would like to know how to insert an "X" in all cells selected in a table? I've tried this : Selection.TypeText Text:="X" But this code just put only one "X" in a selection of 6 cells !!! I'ld like to have a "X" in all 6 cells. These cells are to be selected a differents places in the table. Thanks for any advice. Jed |
Thread Tools | |
Display Modes | |
|
|