Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Macro to hide cols

I would like a macro that would allow me to hide col B to the selected col, minus one col(ie If I place the cursor on col F then col B thru E would be hidden or if the cursor is on COL J, the macro would hide Col B to I)
Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Macro to hide cols

Hi,

Am Sun, 16 Sep 2012 11:40:22 -0700 (PDT) schrieb pcorcele:

I would like a macro that would allow me to hide col B to the selected col, minus one col(ie If I place the cursor on col F then col B thru E would be hidden or if the cursor is on COL J, the macro would hide Col B to I)


try:

Sub HideCols()
Dim myRow As Long
Dim myAdr As String

myRow = ActiveCell.Row
myAdr = ActiveCell.Offset(0, -1).Address(0, 0)
Range("B" & myRow & ":" & myAdr).EntireColumn.Hidden = True
End Sub


Regards
Claus Busch
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Macro to hide cols

On Sunday, 16 September 2012 14:40:22 UTC-4, pcorcele wrote:
I would like a macro that would allow me to hide col B to the selected col, minus one col(ie If I place the cursor on col F then col B thru E would be hidden or if the cursor is on COL J, the macro would hide Col B to I)

Thanks


That was just great ...and very quick. Thanks
Ian M
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hide Cols ?? LiAD Excel Programming 3 July 8th 09 08:34 PM
Enhance sub to copy cols of variable length into 1 col to snake results into other cols Max Excel Programming 1 August 7th 08 02:03 PM
Range.Select 1st pass 13 cols, 2nd paqss 25 cols twice as wide in error? Craigm[_53_] Excel Programming 2 May 2nd 06 11:04 AM
Cond Format:re color 2 cols, skip 2 cols Tat Excel Worksheet Functions 2 June 22nd 05 06:43 PM
Hide Unused Cols & Rows in a Range Bob Maloney Excel Programming 2 July 31st 03 12:39 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"