#1   Report Post  
Posted to microsoft.public.excel.programming
jgp jgp is offline
external usenet poster
 
Posts: 1
Default column hide


I have sr. no, name, address, address2, address3, and city columns. By
default I want address, address2, address3, and city column hidden. When I
enter more than 3 character in name colums automatically all hidden columns
should be view or unhide.

THANKS,
jgp
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default column hide

jgp,

Copy and paste the below code in the sheet where you are having those columns.

------ Code Begins

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Column = 2 Then
If Len(Target.Value) 3 Then
For I = 3 To 6
Cells(, I).EntireColumn.Hidden = False
Next I
End If
End If


End Sub

------ Code Ends

Also paste the below code in the ThisWorkbook event.

------ Code Begins

Private Sub Workbook_Open()

For I = 3 To 6
Sheet1.Cells(, I).EntireColumn.Hidden = True
Next I


End Sub

------ Code Ends

Revert to me, if you've any probs in this.

--
Regards,
Sriram Subramaniyan


"jgp" wrote:


I have sr. no, name, address, address2, address3, and city columns. By
default I want address, address2, address3, and city column hidden. When I
enter more than 3 character in name colums automatically all hidden columns
should be view or unhide.

THANKS,
jgp

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default column hide

So if you have 2 character names in rows 1-10, and then you enter a 3 char
name, you want those columns unhidden, which will show them for the other
rows as well?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"jgp" wrote in message
...

I have sr. no, name, address, address2, address3, and city columns. By
default I want address, address2, address3, and city column hidden. When

I
enter more than 3 character in name colums automatically all hidden

columns
should be view or unhide.

THANKS,
jgp



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default column hide

Hi jgp,

You can do that trough Userform control
that more easy to use and understand.
Try this :
Private Sub TextBox1_KeyDown(ByVal KeyCode As _
MSForms.ReturnInteger, ByVal Shift As Integer)
If Len(TextBox1.Value) = 2 Then
Columns("B:E").Hidden = False
Else
Columns("B:E").Hidden = True
End If
End Sub

Rgds,

Halim

jgp menuliskan:
I have sr. no, name, address, address2, address3, and city columns. By
default I want address, address2, address3, and city column hidden. When I
enter more than 3 character in name colums automatically all hidden columns
should be view or unhide.

THANKS,
jgp


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 Column If Usedrange of Column ISBLANK Follow-up [email protected] Excel Discussion (Misc queries) 1 April 12th 09 10:00 PM
Hide Column If Usedrange of Column ISBLANK [email protected] Excel Discussion (Misc queries) 4 April 12th 09 09:47 PM
UN-hide column A???? The Hun Excel Discussion (Misc queries) 2 February 23rd 08 06:37 AM
Hide column or row based on a cell in the column or row? SacGuy Excel Discussion (Misc queries) 0 January 24th 06 06:51 PM
How to hide a column when value=1 angeloso Excel Programming 2 October 25th 05 12:08 PM


All times are GMT +1. The time now is 04:35 PM.

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

About Us

"It's about Microsoft Excel"