Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Hidding columns

First I have to say SORRY
I posted this request a while back. Got a very good answer, applied it and
it worked very well
Then I accidently erase the entire macro
Pleas help again
Many thanks


I sure could use some help with this problem
I want to build a macro that will hide and an other macro that will unhide
columns.
I want the macro to hide columns starting with the col where the cursor is
located all the way back to and include column B
Then I would require a macro to unhide the same columns.
I would appreciate any help I can get



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Hidding columns

From Ramesh

Dear pcor,

The foll code will do ur req,

Sub Myhide()
With Excel.Application
.Sheets("Sheet4").Select
.Cells(1, .ActiveCell.Column).Select
.Range(.ActiveCell, .Range("B1")).Select
.Selection.EntireColumn.Hidden = True
End With
End Sub

Sub MyUnhide()
With Excel.Application
.Sheets("Sheet4").Select
.Selection.EntireColumn.Hidden = False
.Range("A1").Select
End With
End Sub

Regards,
Ramesh
------------------
From Orlando Magalhaes Filho
Hi,

See this:

Sub HideColumns()
Range(Cells(1, ActiveCell.Column), Cells(1, 256)).EntireColumn.Hidden =
True
Range("B1").EntireColumn.Hidden = True
End Sub

Sub UnHideColumns()
Range(Cells(1, ActiveCell.Column), Cells(1, 256)).EntireColumn.Hidden =
False
Range("B1").EntireColumn.Hidden = False
End Sub


HTH

---
Orlando Magalhães Filho
------------------------

From Brian B

No need for 2 macros. This one will do the job :-

'------------------------------------------------------
Sub HIDE_UNHIDE()
Dim SetStatus As Boolean
'- check if column B hidden
If ActiveSheet.Columns(2).Hidden = True Then
ActiveSheet.Columns.EntireColumn.Hidden = False
Else
For c = 2 To ActiveCell.Column
ActiveSheet.Columns(c).EntireColumn.Hidden = True
Next
End If
End Sub
'------------------------------------------------------

Regards
BrianB

--
Regards,
Tom Ogilvy



pcor wrote in message
le.rogers.com...
First I have to say SORRY
I posted this request a while back. Got a very good answer, applied it and
it worked very well
Then I accidently erase the entire macro
Pleas help again
Many thanks


I sure could use some help with this problem
I want to build a macro that will hide and an other macro that will

unhide
columns.
I want the macro to hide columns starting with the col where the cursor is
located all the way back to and include column B
Then I would require a macro to unhide the same columns.
I would appreciate any help I can get





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
Hidding #DIV/0! In Cell Susan Excel Worksheet Functions 1 May 23rd 07 10:36 PM
Hidding #DIV/0! In Cell Susan Excel Worksheet Functions 0 May 23rd 07 07:15 PM
Hidding #DIV/0! In Cell Xena_Peel Excel Worksheet Functions 3 May 23rd 07 06:53 PM
Hidding #DIV/0! In Cell Harlan Grove[_2_] Excel Worksheet Functions 0 May 23rd 07 06:49 PM
Hidding #DIV/0! In Cell Harlan Grove[_2_] Excel Worksheet Functions 0 May 23rd 07 06:49 PM


All times are GMT +1. The time now is 08:34 PM.

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"