ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   runtime error (https://www.excelbanter.com/excel-programming/372758-runtime-error.html)

Janis

runtime error
 
I got a type mismatch run-time error on the line to set the range.
I just want to hide columns 0 - Z or columns 16-26.
Can you help me set the range right?
thanks,


Sub HideXtraCells()
Dim rng As Range
' HideCells Macro

Set rng = Columns("0:Z")

rng.EntireColumn.Hidden = True

End Sub


Norman Jones

runtime error
 
Hi Janis,

Set rng = Columns("0:Z")


Replace 0 (zero) with O (upper case letter O)


---
Regards,
Norman



"Janis" wrote in message
...
I got a type mismatch run-time error on the line to set the range.
I just want to hide columns 0 - Z or columns 16-26.
Can you help me set the range right?
thanks,


Sub HideXtraCells()
Dim rng As Range
' HideCells Macro

Set rng = Columns("0:Z")

rng.EntireColumn.Hidden = True

End Sub




Janis

runtime error
 
I got the answer, thanks anyways.

Sub HideXtraCells()

' HideCells Macro



Columns("O:Z").EntireColumn.Hidden = True

End Sub

"Janis" wrote:

I got a type mismatch run-time error on the line to set the range.
I just want to hide columns 0 - Z or columns 16-26.
Can you help me set the range right?
thanks,


Sub HideXtraCells()
Dim rng As Range
' HideCells Macro

Set rng = Columns("0:Z")

rng.EntireColumn.Hidden = True

End Sub


Janis

runtime error
 
You are right thanks, I still didn't have the answer but almost. i wondered
why it crashed.

"Norman Jones" wrote:

Hi Janis,

Set rng = Columns("0:Z")


Replace 0 (zero) with O (upper case letter O)


---
Regards,
Norman



"Janis" wrote in message
...
I got a type mismatch run-time error on the line to set the range.
I just want to hide columns 0 - Z or columns 16-26.
Can you help me set the range right?
thanks,


Sub HideXtraCells()
Dim rng As Range
' HideCells Macro

Set rng = Columns("0:Z")

rng.EntireColumn.Hidden = True

End Sub






All times are GMT +1. The time now is 01:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com