Recording a macro (instructions XL2000)
Tools --> Macro --> record macro (record/stop recording)
Tools --> Macro --> macros... (Alt+F8) --> (select macro) --> Edit or Run
Option Explicit
Sub Macro2()
'
' Macro2 Macro
' Macro recorded 05/19/2000 by David McRitchie
Range("G6").Select
End Subl
Sub Macro3()
'
' Macro3 Macro
' Macro recorded 05/19/2000 by . David McRitchie
Selection.Cells.Interior.ColorIndex = xlNone
End Sub
Recording a macro only gives you a general idea of commands.
CELLS is probably what you want to use, look at help
within VBA. In XL95 look at Help from a Module sheet.
In XL97 and up look at Help from the VBA Editor (Alt+F11).
Instructions to install a macro can be found in
http://www.mvps.org/dmcritchie/excel/formula.htm
Here is a macro to give you an idea:
Option Explicit
Sub Shoul2()
Dim R As Long
Dim C As Long
R = ActiveCell.Row
C = ActiveCell.Column
Cells.Interior.ColorIndex = xlNone
Cells(R, C).Interior.ColorIndex = 19
C = InputBox("Supply Column Number")
Cells(R, C).Select
Cells(R, C).Interior.ColorIndex = 8
'Range("G6").Select
End Sub
Integer variables are stored as 16-bit (2-byte) numbers ranging in value from -32,768 to 32,767. The type-declaration character for Integer is the percent sign (%).
XL2000 can have 65,536 rows so use Long if reference is to Rows.
XL2007 has increased both rows and columns so use Long for both.
Long (long integer) variables are stored as signed 32-bit (4-byte) numbers ranging in value from -2,147,483,648 to 2,147,483,647. The type-declaration character for Long is the ampersand (&).