Creation of a range with no specified address

A

Adrix

Hello

Somone knows how can i set a range (with the same property an
actions) ,defining the number of cell but not defining where it will b
located?
eg: a window (2X2) wich the cell(1,1) is fixed "my name"

I am trying this

Function windowx(cellx) As Range

cellx.Value = "myname"

Set windowx = Range(cellx, celx.Offset(1, 1))

End Function

and i am getting " object required"

All help wiil be welcome

thank yo
 
B

BrianB

We do not normally use UDFs to perform actions but to return values. S
I have used a subroutine. :-

'=================================
Dim Mywindowx As Range
'-------------------
Sub test()
windowx Application.ActiveCell
MsgBox (Mywindowx.Address)
End Sub
'--------------------
'-
Sub windowx(cellx As Range)
cellx.Value = "myname"
Set Mywindowx = Range(cellx, cellx.Offset(1, 1))
End Sub
'=================================
 
Top