Excel Offset property - VBA
Offset property
--------------------
offset property allows 2 arguments that correspond to the position on the cell. Example
--------
Object.offset (RowOffset, ColumnOffset)
ActiveCell.Offset (0, 0). Select 'as we put 0 for the arguments row and column selection
remains our initial active cell.
Activecell.0ffset (1.0). Select 'now the active cell is a line below
' if our initial active cell hubise now been active cell A1 A2 would
Activecell.0ffset Msgbox (1 , 0).
address
is also important to note that you get an error if you assign or tratamoos we move to a range of non-existent.
eg ActiveCell.Offset (-5, 0). Select 'we throw an error because there is no range is selected it would be 5 rows up from A2.
Similarly we can move between varying the value colmnas ColumnOffset
ActiveCell.Offset (0, 1). Select 'Move one column to the right
We may also use these arguments (RowOffset, ColumnOffset) to indicate where to move or assign a value to a particular cell. Sub
sample_vba_offset ()
As Range Dim RANGE RANGE
September
= Range ("B1")
RANGO.Offset (2, 4). Value = "27 May Champions Grand Final League - 2009 "
'we move below 2 rows and 4 columns to the right
End Sub' eye ... the same way you get an error if we try to move or assign a value to a range not existing.
ActiveCell.Offset (0, -3). Select 'move 3 columns to the left
Sunday, May 24, 2009
Sunday, February 1, 2009
What To Write In Wedding Guestbook
Major Events of the form (Initialice, Activate,
Major Events ------------------ Form ----------------
Initialice. **********
run before you load or display the UserForm Activate
. ********
runs when the form is displayed. QueryClose
----------
runs before downloading the form
Terminate
--------- Runs after downloading the form
* The first event to be executed using the method show the initialice ..
For example ... this macro sub abrir_formulario
Userform1.Show
End sub
Desencadenera Userform1 Initialize event Private Sub
UserForm_Initialize ()
Msgbox "starting" End Sub
y. .. This macro download the form ff events triggered the
Sub Close () Unload UserForm1
End sub
1.QueryClose
2.Terminate
Private Sub
UserForm_QueryClose (Cancel As Integer, CloseMode As Integer) Msgbox
"I'm going"
End Sub Private Sub
UserForm_Terminate () End Sub
Major Events ------------------ Form ----------------
Initialice. **********
run before you load or display the UserForm Activate
. ********
runs when the form is displayed. QueryClose
----------
runs before downloading the form
Terminate
--------- Runs after downloading the form
* The first event to be executed using the method show the initialice ..
For example ... this macro sub abrir_formulario
Userform1.Show
End sub
Desencadenera Userform1 Initialize event Private Sub
UserForm_Initialize ()
Msgbox "starting" End Sub
y. .. This macro download the form ff events triggered the
Sub Close () Unload UserForm1
End sub
1.QueryClose
2.Terminate
Private Sub
UserForm_QueryClose (Cancel As Integer, CloseMode As Integer) Msgbox
"I'm going"
End Sub Private Sub
UserForm_Terminate () End Sub
Subscribe to:
Posts (Atom)