hide a column

hi

can u help me with this

what i want is that if in a column there is written "Blank" a comman
that hides that particular column

plz help me with thi

--
Message posted from http://www.ExcelForum.com

0
5/5/2004 5:56:48 PM
excel.misc 78881 articles. 5 followers. Follow

14 Replies
897 Views

Similar Articles

[PageSpeed] 49

Hi
try the following macro (looks in row 1 for this word 'Blank')
Sub hide_columns()
Dim ColNdx As Long
application.screenupdating=False
For ColNdx = 1 to 256
        If Cells(1, ColNdx).Value = "Blank" Then
            Columns(ColNdx).hidden = True
        End If
Next ColNdx
application.screenupdating=True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


> hi
>
> can u help me with this
>
> what i want is that if in a column there is written "Blank" a command
> that hides that particular column
>
> plz help me with this
>
>
> ---
> Message posted from http://www.ExcelForum.com/

0
frank.kabel (11126)
5/5/2004 6:15:20 PM
Hi Vikram,

Here is a similar way.

You didn't specify if it was the first cell in the column, but I'
assuming it is.  Try this.

Sub HideIt()
'The sheet needs to be named 'Sheet1', or change the code if it i
something else
For Each col2 In Worksheets("Sheet1").Columns
'This is specifying the value it is looking for..change 'Blank' to b
whatever you wish
If col2.EntireColumn.Cells(1, 1).Value Like "Blank*" Then

col2.EntireColumn.Hidden = True


End If
Next
End Sub


Cheers,

Jo

--
Message posted from http://www.ExcelForum.com

0
5/5/2004 6:22:30 PM
thank u so much

but this will look in row 1 only
can we have it for all rows and a smaller one if it is possible

thank u so much
i really appreciate ur hel

--
Message posted from http://www.ExcelForum.com

0
5/5/2004 6:27:43 PM
hi job!

"Blank" written can be in any column and in any row. and if it is 
want to hide that column

thank u so much for ur hel

--
Message posted from http://www.ExcelForum.com

0
5/5/2004 6:31:13 PM
Hi
o.k. try the following:
Sub hide_columns()
Dim rng as range
dim cell as range
set rng = activesheet.usedrange
application.screenupdating=False
For each cell in rng
        If Cell.Value = "Blank" Then
            Columns(cell.column).hidden = True
        End If
Next cell
application.screenupdating=True
End Sub

-- 
Regards
Frank Kabel
Frankfurt, Germany


> hi job!
> 
> "Blank" written can be in any column and in any row. and if it is i
> want to hide that column
> 
> thank u so much for ur help
> 
> 
> ---
> Message posted from http://www.ExcelForum.com/
0
frank.kabel (11126)
5/5/2004 6:39:15 PM
Ok,

Try this.

Sub HideIt()

Selection.CurrentRegion.Select
For Each Cell In Selection
'if you wanted to literally check each cell..I wouldn't recommend as i
would take a long time.
'For Each Cell In ActiveSheet.Cells
If Cell.Value = "Blank" Then
Cell.EntireColumn.Hidden = True

End If
Next Cell

End Su

--
Message posted from http://www.ExcelForum.com

0
5/5/2004 6:42:46 PM
thank u so much but if i want to check only column : A,B,C,D then wha
is the way out

thanks agai

--
Message posted from http://www.ExcelForum.com

0
5/5/2004 6:45:55 PM
but the macro is not working, i have checked it twic

--
Message posted from http://www.ExcelForum.com

0
5/5/2004 6:51:20 PM
vikram wrote:
> *but the macro is not working, i have checked it twice * 

Are you sure the value in the cell is actually "Blank"?  you could us
the 'like' that we used earlier and put  Value Like "*Blank*" 

Try that..

--
Message posted from http://www.ExcelForum.com

0
5/5/2004 6:54:00 PM
Hi
try
Sub hide_columns()
Dim Col_index as integer
Dim row_index as long
Dim lastrow as long

application.screenupdating=False
For col_index = 1 to 4
        lastrow = ActiveSheet.Cells(Rows.count,
col_index).End(xlUp).row
        for row_index = 1 to lastrow
            if cells(row_index,col_index).value = "Blank" then
                columns(col_index).hidden=True
                exit for
            end if
        next row_index
next col_index
application.screenupdating=True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany


> thank u so much but if i want to check only column : A,B,C,D then
what
> is the way out
>
> thanks again
>
>
> ---
> Message posted from http://www.ExcelForum.com/

0
frank.kabel (11126)
5/5/2004 7:05:16 PM
i have attached the file, u can check this is a test file

                 Attachment filename: blank.xls                 
Download attachment: http://www.excelforum.com/attachment.php?postid=534995
---
Message posted from http://www.ExcelForum.com/

0
5/5/2004 7:16:13 PM
any suggestions frnd

--
Message posted from http://www.ExcelForum.com

0
5/6/2004 11:30:05 AM
Hi
have you tried my macro (see below). Just inserted it in your workbook
and it hides the columns

----
Sub hide_columns()
Dim Col_index as integer
Dim row_index as long
Dim lastrow as long

application.screenupdating=False
For col_index = 1 to 4
        lastrow = ActiveSheet.Cells(Rows.count, _
col_index).End(xlUp).row
        for row_index = 1 to lastrow
            if cells(row_index,col_index).value = "Blank" then
                columns(col_index).hidden=True
                exit for
            end if
        next row_index
next col_index
application.screenupdating=True
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany


> any suggestions frnds
>
>
> ---
> Message posted from http://www.ExcelForum.com/

0
frank.kabel (11126)
5/6/2004 5:58:24 PM
thank u so much frank

i am really thankful to u
i really appreciate ur hel

--
Message posted from http://www.ExcelForum.com

0
5/6/2004 7:40:17 PM
Reply:

Similar Artilces:

summing a column according to criteria of two other columns
I am creating a cash flow forecast sheet and trying to add up the project values of a particular service provided in june this year. i am attempting to do this by referring to a sheet called data which has a column of project values (N), a column with the month and year of the project (V) written as 62004 and a column of services (E) of which i want to select those projects where the service was Translation - Standard. By looking at the help for countif by multiple criteria i altered the formula to a sumif. I am using the formula... =SUM(IF((Data!$E$3:$E$2000='Translation - Standard'...

Hiding "0" values in pivot table
In a worksheet I have a listing of stock records with ItemNumber, Date, StockLocation and NumberOnStock. When I make simple Pivot Table with ItemNumber and StockLocation as rows and select a Sum of "NumberOnStock" I would like to hide rows where the sum is "0". But this does not seem to be possible. Tried to follow the guidelines in the Microsoft article: http://office.microsoft.com/en-us/assistance/HP051998791033.aspx#Hide%20zero%20values%20in%20a%20PivotTable%20report But no luck :-( Mogens You could use conditional formatting on these cells - highlight the cells,...

Not allowing Alpha Characters in a Numeric Formatted Column
I have a spreadsheet that we provide to vendors where they have to fill in their product data and send it back to us where we import this data into the products database. I have the spreadsheet set up the way I want it and have drop down boxes where applicable for data validation. I have several fields that i only want #'s. Sometimes integers, sometimes there may be a decimal. I set the formats accordingly. HOwever, you can still type the letter A or B or C etc... in there. I only want them to be able to type in #'s. In access I can use a mask. Is there anything similar in Exce...

Hiding formuals in cells question
Hi. I was wondering if there was a way to hide the formulas in cells without protecting the sheet. I am making something for other teachers at my school and I want to hide the formulas so they won't mess anything up on the spreadsheet. Any help would be greatly appreciated. Thanks! Hi not without protecting the sheet but why is this a problem for you? -- Regards Frank Kabel Frankfurt, Germany "JP" <JP@discussions.microsoft.com> schrieb im Newsbeitrag news:ABFE07BF-6087-4E24-814A-03AF8863A633@microsoft.com... > Hi. I was wondering if there was a way to hide the fo...

display columns alphabetically
Columns used to display alphabetically left to right. It changed to now displaying numerically left to right. How do I change back to alphabetically? Go to Tools|Options and then in the General tab, uncheck R1C1 reference style. -- NBVC Where there is a will there are many ways. 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ NBVC's Profile: http://www.thecodecage.com/forumz/member.php?userid=74 View this thread: http://www.thecodecage.com/forumz/showthread.php?t=136818 Perfect, thanks for easing my f...

hide my name
When replying to an email or creating one from scratch how do i hide my name in the "from" field...thx fred <fdbjrgetridofthis@wowway.com> wrote: > When replying to an email or creating one from scratch how do i hide > my name in the "from" field...thx Are you saying you want the reply to be anonymous? -- Brian Tillman [MVP-Outlook] no, I don't mind if my email is revealed.. just my name. I have tried by removing it from the "User Name:" field in the email account but it continues to show up. I have also removed from the header informati...

Convert Column Letters to Number
Hi! I'm looking for a function to convert a "large" column letters (up t 10 characters) to it's equivalent in number. e.g. Input=A Output=1 Input=AAA Output=703 Input=EXCEL Output=2,708,874 Any suggestions? Regards -- Message posted from http://www.ExcelForum.com Here's a VBA function that gives the results you want: Option Explicit Function ColumnToNumber(sText As String) As Variant Dim Bytes() As Byte Dim Letter As Long Dim Multiplier As Double Dim N As Double Dim Total As Double ColumnToNumber = CVErr(xlErrValue) If L...

Hiding and Un-Hiding Data fields
I am using a form for people to select data via dropdown menus and then having it run through a query to filter results. Is there a way that I can have certain feilds hidden until a toggle button or something of the like is clicked? Basically I want have three choices of buttons: Year, Quarter, and Month. What I ideally want to happen is when someone selects the button for year, a hidden drop down menu appears where they can then choose from the available years to filter through the query. I would say I am above average with using access, but I have no idea how to hide fields and then...

How do I hide gaps in an Excel 2007 chart?
I have a bar chart that is showing gaps and i don't want them. The select data > hidden and empty cell button does not give an option to hide gaps. I think by default they are hidden but if you even click on this to see what it does the gaps are shown and no way to turn off. Hi, If you hide the actual rows then with the Plot visible cells only setting on the gaps will be removed. In xl2007 the setting is on the Select Data dialog, Hidden/empty cells button. Cheers Andy Waynesch wrote: > I have a bar chart that is showing gaps and i don't want them. The s...

Hiding a worksheet #3
I want to hide a worksheet. So, I went to the format menu and the "worksheet" option is grayed out. Why? And, how do I "ungray" it. Hi is your worksheet protected ? -- Regards Frank Kabel Frankfurt, Germany llong wrote: > I want to hide a worksheet. So, I went to the format menu and the > "worksheet" option is grayed out. Why? And, how do I "ungray" it. I think Frank meant to ask about the Workbook--not the worksheet. (Check under Tools|protection|Protect workbook or Unprotect workbook) My question is: Is there another sheet in the w...

Cannot add columns to custom views
I have a problem that is causing a major handicap. I cannot add any columns to any custom leads view that I create. No matter what, the only column that is displayed is the default key column (name) that is there when the view is created. When I click on add columns, the dialog box that is supposed to list columns that I can add to the view has no columns listed at all. I am logged in as the System Administrator when trying to accomplish this. Also, when I create a filter criteria it is never saved. I save it, but when I go back into it, it is gone. Any help would be GREATLY apprec...

VBA write macro change column with 3 number digits to 4 digits the
-- James Do you mean Sub Macro() Range("D1:D10").NumberFormat = "0000" End Sub -- Jacob "James C" wrote: > > -- > James Use the white space (here) to record details of your requirements - don't try to put it all in the message header. Pete On Jan 25, 1:51=A0pm, James C <Jam...@discussions.microsoft.com> wrote: > -- > James Thanks for your response -- James "Jacob Skaria" wrote: > Do you mean > > Sub Macro() > Range("D1:D10").NumberFormat = "00...

Hide images when Hiding Rows
I have inserted images into cells, but when I hide the column the images are not hidden with that column, they just get squished between the two cells next to the hidden cell. Is there a setting or way to tie the image to that cell so that it hides/unhides appropriately with the row? -- kurt ------------------------------------------------------------------------ kurt's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=35686 View this thread: http://www.excelforum.com/showthread.php?threadid=554712 Kurt You cannot insert an image into a cell. You can overlay ...

Hiding plot Area
I have a formatted output sheet that has a Pie Chart embedded. The data for the pie chart comes from a second sheet using 2 ranges B2:B6 & D2:D6 B2:B6 is always populated and contains labels. What I want to do is, when D2:D6 contains 0 in each cell (or Null), suppress the Pie chart but always show the Legend (which is driven by B2:B6) Many Thanks Adam Adam - All you see of the pie when all values are zero is a single line at the first slice. The legend still appears. To hide the line, double click on one of the wedges and on the Patterns tab, change the Border setting to None. ...

Repeating columns cuts off merged cells
Hi all, I hope you can help because I can't find a solution to this one. I've got a two page spreadsheet (side by side) and I'm trying to repeat columns A & B because their row headings on the left and should only appear when printed (split onto two pages) (as in print setup > columns to repeat at left > $A:$B), ...... but B57:I57 are merged and wrapped (another grief that merged wrapped cells don't auto height, but that's for another day) and so are B58:I58 and B59:I59 (footer things). ...... and when printed, B57:I57, etc. cuts off on the second page and...

how to hide an ActiveX control?
hi there i have an ActiveX control, written in C++, which has the OLEMISC_INVISIBLEATRUNTIME flag set, yet when i display the web page it is attached to, i get the familiar "red cross" graphic in the middle of the screen - how can i hide the control so nothing is displayed at all? tia bhu can u set the size of ur control as 1x1 pixels "bhu Boue vidya" <bhuvidya@yahoo.com.au> wrote in message news:1175703214.292931.252210@e65g2000hsc.googlegroups.com... > > hi there > > i have an ActiveX control, written in C++, which has the > OLEMISC_INVISIBLEATR...

Hiding rows with VBA
Hi all, In my sheet called "insertsheet I have this VBA: (thanks to some users of Google groups) Private Sub Worksheet_Change(ByVal Target As Range) Const nMAX As Long = 10 Dim nRows As Long Application.ScreenUpdating = False With Me With .Range("B8") If Intersect(Target(1), .Cells) Is Nothing Then Exit Sub nRows = .Value End With .Range(.Cells(1, 5), .Cells(1, _ .Columns.Count)).EntireColumn.Hidden = True .Range(Cells(1, 5), .Cells(1, _ ...

hiding rows
I have data in cells A7:DK394 which all have 0 in them until totals are added in other worksheets which then pullthrough. At the end of the week I have to Hide all rows from A7 to A394 that still have 0 in them as no totals have been added in other sheets so the customer has not posted with us. is there any way excell can recognise the cells that have no data against them and hide them automatically by pressing a button. or if they all start off hidden unhide as data is entered. Hopefully this makes sense many thanks for any help with this as again its to save me lots of...

Outlook-hiding recipients addresses
How do you send a mailing to a distribution list without exposing their email addresses to the other recipients? Put the DL name in the BCC field and put your own address in the TO field. anonymous@discussions.microsoft.com wrote: > How do you send a mailing to a distribution list without > exposing their email addresses to the other recipients? ...

Hide contacts
I must hide some contacts from GAL excepted for 2 user that must to see them and select to send email. If only 2 users need a Contact, why not have them create it in their Contacts folder? -- Bharat Suneja MVP - Exchange www.zenprise.com NEW blog location: www.exchangepedia.com/blog ---------------------------------------------- "MauroR" <MauroR@discussions.microsoft.com> wrote in message news:DAC0E2E9-7389-49F0-8736-3B9251DBB274@microsoft.com... >I must hide some contacts from GAL excepted for 2 user that must to see >them > and select to send email. Th...

How do I hide email addresses in outgoing mail
Hint: You post your question in the body of the post, not the Subject. Hint 2: Use the BCC field. -- Russ Valentine [MVP-Outlook] "Dennis" <Dennis@discussions.microsoft.com> wrote in message news:B2C2A70C-6C94-4688-8BAF-0A50AC9C142D@microsoft.com... > "Dennis" <Dennis@discussions.microsoft.com> wrote in message news:B2C2A70C-6C94-4688-8BAF-0A50AC9C142D@microsoft.com... > PLEASE write your question in the body of the post and NOT just the subject Have a look here: http://dts-l.net/goodpost.htm As posted here MANY MANY times - put them in the BCC...

Can I Hide a Field?
I'm wanting to hide a field on a form (products form in this case) for some users but not for other users. Is this possible? For example, can I hide the product cost (wholesale) of an item for the salesperson, but not for the CEO? -- Brandon IT Director Office Equipment & Supplies at http://www.presentationsdirect.com Hi Brandon, You cannot have different formlayouts for different users/Teams at this time... Regards, Michael Randrup "Brandon S." <bsmith@presentationsdirect.nospam.com> wrote in message news:e4pDiMrYDHA.1620@TK2MSFTNGP12.phx.gbl... > I'm ...

Criteria is entered in 2 columns, query is only utilizing one set of criteria
Access 2007 I have a flight column and a date column. There are specific flights for specific dates I want to see data for. The query is returning the right flights, but ALL dates, not limited to the ones I want. If I remove the flight criteria, it limits my dates as desired. What is the deal? WHY are the simplest of tasks made so much more difficult in this release of Office??? Why post twice? Folks volunteer their time here, so if no one responds right away, maybe they're busy or don't know or ... Regards Jeff Boyce Microsoft Access MVP -- Disclaim...

Hide Unhide Hide again
Hello, I'm using Excel 2003. It seems in the older versions, when I hid a column or row, it would put a little "+" tab above the labels. You could easily "click" or "unclick" ("hide" or unhide") the columns or rows. I need to be able to hid these rows or columns, but unhide them for use and then hid them again for ease of use and printing. Thank you. Hiding rows/columns and Grouping/Outline are quite different features. The little + sign occurs when you group (outline) it's not actually hiding rows Its under the DATA > GROUP AND O...

Parse only text from column?
How do I extract just the text from a column? For example, if one of my columns = "1234 abracadabra" and I want just the "abracadabra"? ironryan77 You already posted this question about 3+ hours ago and that message has 4 answers posted to it. -- Rick (MVP - Excel) "Ryan D" <RyanD@discussions.microsoft.com> wrote in message news:DB85FF3E-1428-4703-B8D5-A0E330DF6E74@microsoft.com... > How do I extract just the text from a column? For example, if one of my > columns = "1234 abracadabra" and I want just the "abracad...