Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / February 2006

Tip: Looking for answers? Try searching our database.

selecting adjacent cells

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tom M - 23 Feb 2006 00:34 GMT
I have searched help for the proper usage of cell commands but have not been
able to identify anything that allows me to select a cell, and by means of a
macro, select the adjacent cell and invoke an insertion macro I created.  
It's the selection of the adjacent cell that is driving me crazy.  On a macro
level scale of 1 to 10, with 1 being  beginner, I am probably a two.  I can
create some macros but nothing fancy.  Thanks in advance for your help.

Tom M
Chip Pearson - 23 Feb 2006 00:43 GMT
Try something like

ActiveCell(1,2).Select

Signature

Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

>I have searched help for the proper usage of cell commands but
>have not been
[quoted text clipped - 10 lines]
>
> Tom M
Tom M - 24 Feb 2006 02:06 GMT
Thanks Chip.  But all this does is move the cursor.  Maybe it would help if I
provide more information.  I have a lengthy list that I process daily.  I
have 9 columns of data and have to match 2 of the rows to a third row.  I
created a macro that inserts cells depending on how many rows I select.  I
have to highlight or select the two columns I need to add cells to.  This is
in liew of using the right click, insert, rows etc.  The macro works well,
but it can still be improved on.  What I would like to do is just leave my
cell pointer in one column and have a macro select the adjacent column to the
right (including the cell where my pointer is) and then insert cells.  I hope
this is clearer.  Think you can make it work?

Thanks

Tom M

> Try something like
>
[quoted text clipped - 14 lines]
> >
> > Tom M
Dave Peterson - 23 Feb 2006 00:49 GMT
You don't usually need to select a cell to work with it.

Option Explicit
sub testme()
 dim myCell as range
 set mycell = activesheet.range("b99") '<-- how do you find the cell to start
 
 mycell.offset(0,1).select
 '.offset(x,y) means go x rows (up or down or 0)
               and y columns (left or right or 0)

....your code
end sub

 

> I have searched help for the proper usage of cell commands but have not been
> able to identify anything that allows me to select a cell, and by means of a
[quoted text clipped - 4 lines]
>
> Tom M

Signature

Dave Peterson

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.