隐藏一个列 [英] Hiding a Column

查看:78
本文介绍了隐藏一个列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我目前正在尝试在电子表格上设计一个按钮,以根据单元格中的值隐藏列。 该按钮将作为最终用户整理工作表的一种方式。 每月每天设计工作表的方式都列在列中的顶部,并且在每个日期下面输入数据,这些日期与当天使用机器的时间相对应。 如果当天是工作日,我已创建了一行添加*(有些周末有效,有些则没有)。 那么我想要做的就是创建一个"检查"的宏。单元格的值,以查看是否存在*。 如果没有,那么我想隐藏整个列,所以只有公司工作的日子才会显示,如果用户再次按下它,我也希望同样的按钮撤消
更改。 任何建议?我已经没有编程了一段时间而且我被困在这个......

解决方案

你可以提供这个功能在用户表单上使用Macors。创建如下所述的Excel工作表


        A           B           C           d          
E             F


1     TRUE


2                           3-JAN-11   星期一及NBSP;          *


3                           4-JAN-11   星期二


4                           5-JAN-11   周三            *


5                           6-JAN-11   周四            *


6                           7-JAN-11    Fri 


在工作表上创建一个复选框,并在单元格A1处提供格式链接。不将下面给出的宏指定给复选框。


取消选中该复选框后,所有行都将显示。当您勾选复选框时,所有行都没有"*"。标记将被隐藏。


Sub HideColumn()

Dim Lastrow As Integer,x As Integer


Lastrow = Range ("C65000")。结束(xlUp)。行


单元格(4,5)。选择


对于x = 1到Lastrow


   如果Cells(1,1).Value =" False"然后

        ActiveCell.EntireRow.Hidden = False

   否则

       如果ActiveCell.Value =" *"然后

        '什么都不是b $ b       否则

        ActiveCell.EntireRow.Hidden = True

       结束如果是
   结束如果是
    ActiveCell.Offset(1,0)。选择


下一个x


单元格(4,5)。选择

结束次


 如果您发送了邮件ID,我可以向您提供显示上述结果的Excel表格。


 


Hello,

I am currently trying to design a button on a spreadsheet to hide a column based on a value in a cell.  The button will serve as a way for the end user to declutter the sheet.  The way the sheet is designed each day of the month is listed acrss the top in columns and data is entered below each date corrisponding to the amount of time the machine was used that day.  I have created a row to add a * to if the day was a work day (some weekends are worked and others are not).  So what I would like to do is to create a macro that "checks" the value of the cell to see if a * is there.  If one is not then I would like to hide the entire column so only days the company worked will be displayed, and I would also like that same button to undo the change if the user presses it again.  Any suggetions? I have been out of programming for a while and I am stuck on this one.....

解决方案

You can Provide this functionality using Macors on User form. Create an Excel sheet as stated below

        A           B           C           D           E             F

1    TRUE

2                          3-Jan-11    Mon           *

3                          4-Jan-11    Tue

4                          5-Jan-11    Wed           *

5                          6-Jan-11    Thu            *

6                          7-Jan-11    Fri 

Create a check box on the sheet and give the format link at cell A1. No assign the macro given below to the check box.

When you uncheck the checkbox all rows will be visible. When you check the check box all row which donot have "*" mark will get hidden.

Sub HideColumn()
Dim Lastrow As Integer, x As Integer

Lastrow = Range("C65000").End(xlUp).Row

Cells(4, 5).Select

For x = 1 To Lastrow

    If Cells(1, 1).Value = "False" Then
        ActiveCell.EntireRow.Hidden = False
    Else
        If ActiveCell.Value = "*" Then
        'Nothing
        Else
        ActiveCell.EntireRow.Hidden = True
        End If
    End If
    ActiveCell.Offset(1, 0).Select

Next x

Cells(4, 5).Select
End Sub

 If you send your mail Id I can provide you the excel sheet showing the above result 

 


这篇关于隐藏一个列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆