Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Change Event

The goal is to have rows with a "" in cells B7-B90 automatically hide when I
change cell B5. I use cell B5 to enter an ID number and cells B7-B90
populate based on vlookup and index functions.

I have the following code in a worksheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
For Each cell In .Columns(2).SpecialCells(xlCellTypeFormulas)
If cell.Text = "" Then cell.EntireRow.Hidden = True
Next cell
End With
End Sub

The macro was working fine, then I renamed the workbook and it dosen't work.

Any suggestions?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Change Event

I can't see why changing the name of the workbook would matter.
Doesn't work is not terribly descriptive.
Calculation set to manual?

This may be a bit quicker.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
.Columns(2).SpecialCells(xlCellTypeBlanks).EntireR ow.Hidden = True

' For Each cell In .Columns(2).SpecialCells(xlCellTypeFormulas)
' If cell.Text = "" Then cell.EntireRow.Hidden = True
' Next cell
End With
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"ToddEZ" wrote in message
...
The goal is to have rows with a "" in cells B7-B90 automatically hide when
I
change cell B5. I use cell B5 to enter an ID number and cells B7-B90
populate based on vlookup and index functions.

I have the following code in a worksheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
For Each cell In .Columns(2).SpecialCells(xlCellTypeFormulas)
If cell.Text = "" Then cell.EntireRow.Hidden = True
Next cell
End With
End Sub

The macro was working fine, then I renamed the workbook and it dosen't
work.

Any suggestions?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Change Event

Apparently the issue is not that I renamed it, I added a password to the file
(using excel 2007). Having a password seems to have disabled the macro.

I'd like to keep the password on the file.

How do I get around this?

"Don Guillett" wrote:

I can't see why changing the name of the workbook would matter.
Doesn't work is not terribly descriptive.
Calculation set to manual?

This may be a bit quicker.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
.Columns(2).SpecialCells(xlCellTypeBlanks).EntireR ow.Hidden = True

' For Each cell In .Columns(2).SpecialCells(xlCellTypeFormulas)
' If cell.Text = "" Then cell.EntireRow.Hidden = True
' Next cell
End With
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"ToddEZ" wrote in message
...
The goal is to have rows with a "" in cells B7-B90 automatically hide when
I
change cell B5. I use cell B5 to enter an ID number and cells B7-B90
populate based on vlookup and index functions.

I have the following code in a worksheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
For Each cell In .Columns(2).SpecialCells(xlCellTypeFormulas)
If cell.Text = "" Then cell.EntireRow.Hidden = True
Next cell
End With
End Sub

The macro was working fine, then I renamed the workbook and it dosen't
work.

Any suggestions?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Change Event

See this page Tod
http://www.rondebruin.nl/password2007.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"ToddEZ" wrote in message ...
Apparently the issue is not that I renamed it, I added a password to the file
(using excel 2007). Having a password seems to have disabled the macro.

I'd like to keep the password on the file.

How do I get around this?

"Don Guillett" wrote:

I can't see why changing the name of the workbook would matter.
Doesn't work is not terribly descriptive.
Calculation set to manual?

This may be a bit quicker.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
.Columns(2).SpecialCells(xlCellTypeBlanks).EntireR ow.Hidden = True

' For Each cell In .Columns(2).SpecialCells(xlCellTypeFormulas)
' If cell.Text = "" Then cell.EntireRow.Hidden = True
' Next cell
End With
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"ToddEZ" wrote in message
...
The goal is to have rows with a "" in cells B7-B90 automatically hide when
I
change cell B5. I use cell B5 to enter an ID number and cells B7-B90
populate based on vlookup and index functions.

I have the following code in a worksheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
For Each cell In .Columns(2).SpecialCells(xlCellTypeFormulas)
If cell.Text = "" Then cell.EntireRow.Hidden = True
Next cell
End With
End Sub

The macro was working fine, then I renamed the workbook and it dosen't
work.

Any suggestions?



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Change Event

Not sure if this would necessarily be quicker, but (see my comments after
the code)...

Private Sub Worksheet_Change(ByVal Target As Range)
Dim C As Range
Dim FirstAddress As String
If Target.Address = "$B$5" Then
On Error GoTo FixItUp
Application.ScreenUpdating = False
Set C = Range("B7:B90").Find("", LookIn:=xlValues)
If Not C Is Nothing Then
FirstAddress = C.Address
Do
C.EntireRow.Hidden = True
Set C = Range("B7:B90").FindNext(C)
Loop While Not C Is Nothing
End If
End If
FixItUp:
Application.ScreenUpdating = True
End Sub

By the way, why isn't your code monitoring cell B5 for change? As written,
it will hide the rows for any change made on the worksheet, not just a
change in B5. Also, your code will affect rows of data outside of the range
B7:B90... it will hide the rows if there is blank cells in Column 2 before
B7 or if there are blank cells in Column 2 after B90 provided there is data
in Rows after them. Oh, and you forgot to include this statement at the end
of your code...

Application.ScreenUpdating = True

and I would handle it using an On Error GoTo trap similar to what I did
above.

--
Rick (MVP - Excel)


"Don Guillett" wrote in message
...
I can't see why changing the name of the workbook would matter.
Doesn't work is not terribly descriptive.
Calculation set to manual?

This may be a bit quicker.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
.Columns(2).SpecialCells(xlCellTypeBlanks).EntireR ow.Hidden = True

' For Each cell In .Columns(2).SpecialCells(xlCellTypeFormulas)
' If cell.Text = "" Then cell.EntireRow.Hidden = True
' Next cell
End With
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"ToddEZ" wrote in message
...
The goal is to have rows with a "" in cells B7-B90 automatically hide
when I
change cell B5. I use cell B5 to enter an ID number and cells B7-B90
populate based on vlookup and index functions.

I have the following code in a worksheet module:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range
Application.ScreenUpdating = False
With ActiveSheet.UsedRange
.Rows.Hidden = False
For Each cell In .Columns(2).SpecialCells(xlCellTypeFormulas)
If cell.Text = "" Then cell.EntireRow.Hidden = True
Next cell
End With
End Sub

The macro was working fine, then I renamed the workbook and it dosen't
work.

Any suggestions?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
apply cell change event to single column - WorksheetChange Event [email protected] Excel Programming 6 May 4th 08 02:28 AM
How do I change a Worksheet_change event to a beforesave event? Tueanker Excel Programming 5 June 29th 07 03:00 PM
MsgBox in Enter event causes combobox not to run Change event Richard Excel Programming 0 March 6th 06 02:52 PM
Change event and calculate event Antje Excel Programming 1 March 29th 05 09:03 PM
change event/after update event?? scrabtree23[_2_] Excel Programming 1 October 20th 03 07:09 PM


All times are GMT +1. The time now is 09:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"