It is good practice to always declare your variables and
to use the default properties of objects.
'---------------
Sub MNO()
Dim x As Variant
Dim Rw As Long
Dim Col As Long
'Transfer range values as a 2 dimensional array to the variant variable.
x = Selection.Value
Rw = UBound(x, 1)
Col = UBound(x, 2)
MsgBox Rw & " " & Col
'Assigns object reference to the variable.
'This works for a variant or range object variable.
Set x = Selection
Rw = x.Rows.Count
Col = x.Columns.Count
MsgBox Rw & " " & Col
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
"excelent"
wrote in message
Hi experts:
Lets say i got:
ActiveSheet.UsedRange.Select
x = Selection
r=Ubound(x) ' numbers of rows
problem is how do i get columns ?
i tryed
c=x.columns
c=x.columns.count
c=Range(x).columns
nothing works grrrrrr
Help pls. :-)