Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Howdie, Im trying to go from column BY all the way to the left till first column of data is found. Then hide all columns one to the right of the last found column. Eg data in column g, then want to hide H to BY. (columns with data will vary. End point is always BY) VB below almost works - it just hides last column with data in it (ie column G) as well, and I need it to hide column H Sub test Application.Goto Reference:="R1C77" Columns("BY:BY").Select Range(selection, selection.End(xlToLeft)).Select selection.EntireColumn.Hidden = True End sub Thanks Darin *** Sent via Developersdex http://www.developersdex.com *** |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub test()
Range(Range("BY1"), Range("BY1").End(xlToLeft)).Offset(0, 1).EntireColumn.Hidden = True End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Darin Kramer" wrote in message ... Howdie, Im trying to go from column BY all the way to the left till first column of data is found. Then hide all columns one to the right of the last found column. Eg data in column g, then want to hide H to BY. (columns with data will vary. End point is always BY) VB below almost works - it just hides last column with data in it (ie column G) as well, and I need it to hide column H Sub test Application.Goto Reference:="R1C77" Columns("BY:BY").Select Range(selection, selection.End(xlToLeft)).Select selection.EntireColumn.Hidden = True End sub Thanks Darin *** Sent via Developersdex http://www.developersdex.com *** |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Darin
Just put in an offset of 1 column and resize by 1 less than your column count, to prevent BZ getting hidden instead. Sub test() Application.Goto Reference:="R1C77" Columns("BY:BY").Select Range(Selection, Selection.End(xlToLeft)).Select Selection.Offset(0, 1).Resize(1, Selection.Columns.Count - 1).Select Selection.EntireColumn.Hidden = True End Sub -- Regards Roger Govier "Darin Kramer" wrote in message ... Howdie, Im trying to go from column BY all the way to the left till first column of data is found. Then hide all columns one to the right of the last found column. Eg data in column g, then want to hide H to BY. (columns with data will vary. End point is always BY) VB below almost works - it just hides last column with data in it (ie column G) as well, and I need it to hide column H Sub test Application.Goto Reference:="R1C77" Columns("BY:BY").Select Range(selection, selection.End(xlToLeft)).Select selection.EntireColumn.Hidden = True End sub Thanks Darin *** Sent via Developersdex http://www.developersdex.com *** |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How can i delete unused row and columns ??? | Excel Discussion (Misc queries) | |||
hiding unused categories in charts | Excel Discussion (Misc queries) | |||
Having a floating row or hiding unused rows? | Excel Programming | |||
Deleting unused columns | Excel Discussion (Misc queries) | |||
After hiding unused columns to the right, border on right disappea | Excel Discussion (Misc queries) |