Question about ).End(xlToRight)

B

Bob Benjamin

In the line below what does End(xlToRight) mean?

wbk1.Sheets(1).Cells(i, j) _ = wbk2.Sheets(1).Cells.Find _
(SEARCHKEY).End(xlToRight)

If there a way to change "End(xlToRight)" in this line to
mean the cell at the same row as the found cell but in the very next column?

Any help would be appreciated.

Bob
 
B

Bob Flanagan

Bob, end(xltoright) does the same thing as presing the End key and the right
arrow.

To specify one cell to the right use .Offset(0,1)

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
 
T

Tom Ogilvy

wbk1.Sheets(1).Cells(i, j).Value = _
wbk2.Sheets(1).Cells.Find _
(SEARCHKEY).Offset(0,1)

End(xltoRight) would be the same as hitting end and right arrow from the
found cell.

Where it ends up would depend on what in the cells to the right.
 
S

shockley

On my computer, .End(xlToRight) works the same as

[crtl + right-arrow]

Whereas

[End + right-arrow]

works the same as

[right-arrow]

by itself.

Regards,
Shockley
 
T

Tom Ogilvy

Maybe I didn't speak clearly. I didn't say End + right arrow, I said end
and right arrow which I admit is ambiguous. Hit the end key and release it
then hit right arrow (and release it).

thats why the command is end(xltoRight)

Now that may match Ctrl+right arrow, with the ctrl key held down, but this
didn't seem to inspire the name the command to be ctrl(xltoright), so End,
then right arrow is probably a more meaningful explanation.

thanks for bringing the ambiguity to my attention.

--
Regards,
Tom Ogilvy

shockley said:
On my computer, .End(xlToRight) works the same as

[crtl + right-arrow]

Whereas

[End + right-arrow]

works the same as

[right-arrow]

by itself.

Regards,
Shockley
 
S

shockley

Thanks for clarifying. I've never seen that before where a key stroke
influences the effect of the following key stroke--but I think I like it!

Regards,
Shockley

Well, glad I asked! I have never before come across a case where a key
stroke influences the effect of the next key stroke.
Tom Ogilvy said:
Maybe I didn't speak clearly. I didn't say End + right arrow, I said end
and right arrow which I admit is ambiguous. Hit the end key and release it
then hit right arrow (and release it).

thats why the command is end(xltoRight)

Now that may match Ctrl+right arrow, with the ctrl key held down, but this
didn't seem to inspire the name the command to be ctrl(xltoright), so End,
then right arrow is probably a more meaningful explanation.

thanks for bringing the ambiguity to my attention.

--
Regards,
Tom Ogilvy

shockley said:
On my computer, .End(xlToRight) works the same as

[crtl + right-arrow]

Whereas

[End + right-arrow]

works the same as

[right-arrow]

by itself.

Regards,
Shockley



Tom Ogilvy said:
wbk1.Sheets(1).Cells(i, j).Value = _
wbk2.Sheets(1).Cells.Find _
(SEARCHKEY).Offset(0,1)

End(xltoRight) would be the same as hitting end and right arrow from the
found cell.

Where it ends up would depend on what in the cells to the right.

--
Regards,
Tom Ogilvy



In the line below what does End(xlToRight) mean?

wbk1.Sheets(1).Cells(i, j) _ = wbk2.Sheets(1).Cells.Find _
(SEARCHKEY).End(xlToRight)

If there a way to change "End(xlToRight)" in this line to
mean the cell at the same row as the found cell but in the very next
column?

Any help would be appreciated.

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top