VB Code for Hiding Rows

  • Thread starter Thread starter Khalil Handal
  • Start date Start date
K

Khalil Handal

This code will hide row thirty if cell E30="". What should i do so as the
line will be hidden if E30="" and F30=""

Me.Rows(30).Hidden = CBool(Me.Range("E30").Value = "")

Khalil Handal
 
if range("e30")="" and range("f30")="" then rows(30).hidden =true

or
with range("e30")
if .value="" and .offset(,1)="" then
end with
 
I had an error: "End With without With"
Here is the code I have.

Private Sub Worksheet_Calculate()
Application.EnableEvents = False
With Range("e30")
If .Value = "" And .Offset(, 1) = "" Then
End With
Application.EnableEvents = True
End Sub

One more thing please,
How can we have a loop so it can be applied not only on lie 30 but on all
lines from 21 until 45 ?

Khalil
 
2 things. You didn't finish the code and you don't have an end if. Why do
you want to do this EVERY time the sheet calculates?
If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.
 
Hi Don,

I am not sure if I am planning the correct way or not!
I have fourty students. Some of them are Phylodophy students and others are
Theolgy students.

The idea is to print a certificate to show their courses and grades they
receive in both semesters (grades are out of 30).

The names and grades are in one sheet and the certificate is in another
sheet. I choose a name of student and his grades are "looked up" and filled
in the certificate.

I am designing The certificate sheet so that it contains all the subjects
that a student take and then hide the subjects that has no grades yet. (if
no grades exists for a certain subject, this means that the student did not
take the course and it will not be shown in his certifiacte.

P.S. My file is in the Arabic language. If you feel you still need the
file, I can change some of it contents to English so you can follow up.

Thank you,
Khalil Handal
 
Since I really can't re-create your file you will need to modify so that I
can understand.
 
Back
Top