View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default Ubound(x) gives rows in a range-array - but what about columns ?

One way:

Sub GetRowsAndColums()
Dim x As Range
Dim rRow
Dim cCol

ActiveSheet.UsedRange.Select

Set x = Selection
cCol = x.Columns.Count
rRow = x.Rows.Count

MsgBox rRow & " " & cCol

End Sub

Regards

Trevor


"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. :-)