hiding a row

  • Thread starter Thread starter bryan
  • Start date Start date
B

bryan

I'm a newbe with Excel vb. I've done a lot of vb with word but, have a
project with excel.
I have a spreadsheet which gets populated upon open like so:
Private Sub Workbook_Open()

Set objIRConn = CreateObject("irdesktopcontrol.irdesktopcontrolx")
objIRConn.Active = True

'Compnay
If Sheet1.Cells(4, 7) = "" Then
strCo = objIRConn.Filename
Sheet1.Cells(4, 7) = strCo
End If

What I want to do is hide row a90 if this is blank.
The Sheet is protected.

Thanks,
Bryan
 
I believe this will work.

If Sheet1.Range("A90") = "" Then
Sheets("Sheet1").Unprotect
Rows(90).Hidden = True
Sheets("Sheet1").Protect
End If
 
Bryan,
You can also make this work without unprotecting the sheet if you set UserInterfaceOnly to True when protecting it (and you need to protect it with UserInterfaceOnly set to True in the Workbook_Open event as it only persists while the workbook is open).
HTH,
Paul
 
Almost...
What I am using is :
If Sheet1.Cells(7, 3) = "" Then
Sheets("Sheet1").Unprotect
Rows(90).Hidden = True
Sheets("Sheet1").Protect
End If

How can I do this without having the user input the password?

Thanks,
Bryan
 
If Sheet1.Cells(7, 3) = "" Then
Sheets("Sheet1").Unprotect Password:="mypass"
Rows(90).Hidden = True
Sheets("Sheet1").Protect Password:="mypass"


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top