-
trouble hiding columns
Hi everyone,
I am trying to hide a column using the below method:
Range("D:MY1").EntireColumn.Hidden = True
For which i receive the "Method Range of object global failed"
When I change to this: Sheets("TEST").Range("D:MY1").EntireColumn.Hidden = True
I get : Application defined or object defined error.
However in a separate procedure I have used:
Range("2:361").EntireRow.Hidden = True
Which has worked completely fine, hence why I'm, confused this method has not worked for columns.
I also much prefer referencing to columns in numbers, so if anyone could also let me know if that's possible here that would be great!
Thanks in advance!!!
-
Range("D:MY1") doesn't return a valid range because you have it 'from all of Col D to the cell MY1'
Try one of these
Code:
Range("D1:MY1").EntireColumn.Hidden = True
or
Code:
Range("D:MY").Hidden = True
-
Thanks so much, I didn't realise how stupid I was being, must have been staring at it too long!