Evaluating content of cell then doing one of two things in cell


Posted by Jay on February 06, 2002 9:04 PM

I would like to move current cell location from say current cell to one cell to the right and up one cell if there is a particular label in this cell drop down one cell put a particular formula into that cell if no particular label then copy current cell and drop down one cell and paste what was in cell above. I would like to move over again one cell and do same evaluation. I kind of simplified it some.
It is hard to find information on how to move around on sheet such a move up move down move left etc. Thanks Jay

Posted by Derek on February 06, 2002 11:08 PM

Jay
You can use the offset method in your code
example
ActiveCell.Offset(4,8).Select
The first number (4) refers to the row (ie down 4 rows), and the second number (8) refers to the column (ie right 8 columns). to go the other way use the minus sign

Hope this helps
Derek

Posted by Jay on February 07, 2002 10:30 AM

Thank you Derek, I started to use a minus but didn't know. Where do you find info for this?

Posted by Jay on February 07, 2002 10:30 AM

Thank you Derek, I started to use a minus but didn't know. Where do you find info for this?



Posted by Derek on February 08, 2002 4:22 AM

Re: Thank you Derek, I started to use a minus but didn't know. Where do you find info for this?

Jay
Go to the Visual Basic Editor (Alt + F11) and click on help. Search for Offset Property (Range Object). There is an example there. You can't access this help from the the worksheet window.
I am learning this by trial and error myself and one of the best ways to learn code is to use the macro recorder then check the code in the Visual Basic Editor (Tools / Macro / Record New Macro). Carry out the moves you want to make then stop recording (Tools / Macro / Stop Recording).
Have fun
Derek