View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Neal Zimm Neal Zimm is offline
external usenet poster
 
Posts: 345
Default variable for columns(??).property

Of course, I use the range syntax a lot, just didn't think about these
properties.
thanks again,
Neal


"Ron de Bruin" wrote:

Try this Neal

Sub variable_columns1()
Dim first As Integer, last As Integer
first = 13
last = 15
Range(Cells(1, first), Cells(1, last)).ColumnWidth = 20
End Sub

Or to hide

Sub variable_columns2()
Dim first As Integer, last As Integer
first = 13
last = 15
Range(Cells(1, first), Cells(1, last)).EntireColumn.Hidden = True
End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Neal Zimm" wrote in message ...
With your help a while ago I was able to 'vary' the rows being procecessed.
the rows procedure works, I could not get the columns procedure to work.
sub variable_rows()
''' this works
Dim first, last, hiderange
first = 13
last = 15
hiderange = first & ":" & last
Rows(hiderange).Hidden = True
End Sub

Sub variable_columns()
'''this does not work, object error
Dim first, last, workrange
first = 13
last = 15
workrange = first & ":" & last
Columns(workrange).ColumnWidth = 20
End Sub

Help Please.
thanks.


--
Neal Z