Re: Modification in the CODE to HIDE rows and columns that start with ZERO (code given)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Dear Don Guillett,

Thanks for your response.

The code given by you works perfectly, when the user selects the range.
But, I would like to have the code the situation expalined in my
previous mail.

"when the user hits the command button, all the rows and
columns that begin with 0 (ZERO) should be hidden."

So, the user's job is to just hit the command button and not to select
the cells.

Also the code given by you hides the rows but not the columns.

Please help.

Thanks,
Thulasiram


Don Guillett wrote:
try
Sub ifzero()
For Each c In Selection
MsgBox Left(c, 1)
If Left(c, 1) = "0" Then c.EntireRow.Hidden = True
Next
End Sub


--
Don Guillett
SalesAid Software
dguillett1@xxxxxxxxxxxxx
"Thulasiram" <karokelip@xxxxxxxxx> wrote in message
news:1159223564.313886.171890@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello all,

I have been trying to manipulate the code given below to hide the rows
and columns that begin with the number ZERO. But, I am landing into
some sort of error.
I know that the code given below works perfectly to hides any empty row
and column.

Can I know if there is any function or command button code that can be
written to hide the rows and columns that begin with the number ZERO?
(ZERO will be found both in column A and 1st row.) If yes, please help
me with the code.

In other words, when the user hits the command button, all the rows and
columns that begin with 0 (ZERO) should be hidden.

Thanks,
Thulasiram.

Private Sub Hide_Click()
Dim SH As Worksheet
Dim col As Range
Dim rw As Range

Set SH = ActiveSheet

For Each col In SH.UsedRange.Columns
col.Hidden = Application.CountA(col) = 0
Next col

For Each rw In SH.UsedRange.Rows
rw.Hidden = Application.CountA(rw) = 0
Next rw
End Sub


.



Relevant Pages

  • Tool to get MCP ODT at Windows CMD prompt
    ... You basically send a series of ODT commands of your choosing, once, or in a loop, and get the output right in the command ... Dim sHostname ... Sub WriteIt ... WriteIt "" ...
    (comp.sys.unisys)
  • Re: Running Excel
    ... I've gotten away from the SHELL command and am stuck with what appears to be ... Private Sub Command32_Click ... Dim xlWorkbook As Excel.Workbook ... > When you use Shell, you lose all subsequent control of the shelled program. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Read value from text file line, process, then Loop until EOF
    ... Public Sub UserForm_Activate ... Dim inputcmd As String ... 'cmd_execute is a command button on a form that is clicked to excute the ... Dim FileNum As Long ...
    (microsoft.public.excel.programming)
  • retrive preselected value in second drop down list from the first drop down list
    ... Dim objConnection As SqlConnection ... Sub Page_Load ... ' Set up our connection. ... ' Create new command object passing it our SQL query and ...
    (microsoft.public.dotnet.framework.aspnet)
  • Password
    ... It bombs in the COMMAND BUTTON code at: ... Private Sub cmdLetMeIn_Click ... Sub cpw(empid As Long, pw As String) ... Dim cmd1 As Command ...
    (microsoft.public.access.formscoding)