Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Tracey King   on Dec 07 In MS Office Category.

  
Question Answered By: Mehr Malik   on Dec 07

Sometimes, a good way to start is to record  actions as a macro  and then modify
from there, as you have suggested.

But note that the code  recorded will not necessarily by very good VBA. For a
start, it is recording the actions of keystrokes, which is not necessarily the
best way to accomplish a task. Also, it's going to have exact cell  references
in it, plus possibly the setting of lots of attributes that you don't want to
actually change. Use it for information, by all means, but remember that it is
definitely not "good" code.

If you want to handle adjacent cells, there are a couple of facilities you need
to use. cells  (row, col) is how you get to a cell when you already know its row
and column  numbers. It's easy to calculate these when you know the row and
column of your parent cell (Row and Column properties). Alternatively, there is
an Offset (row, column) method that will return a reference to a cell relative
to another. And, of course, the Range method will accept a normal cell
reference (e.g. "C3").

Share: 

 
 


Tagged: