Howdy all! Running 2011 Excel on my 2012 MacBook Pro. Just learning how to use excel passed inputting numbers in someone else's sheet. In making my own sheet, to keep it clean, I hid blank rows, but wanted another blank row to appear, when needed. After asking a few people who don't know VBA, who said there isn't a way, I wrote my own way. I understand it may 100% just be my computer(yes I know I could buy a $50 PC that would be better), but this code takes about 6 seconds to work. Just wondering if there would have been a more efficient way of writing this out? Perhaps making a range within the column, instead of the entire column?
TIA!
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then
Application.EnableEvents = True
Hiderows
StartRow = 7
EndRow = 43
ColNum = 2
For i = StartRow To EndRow
If Cells(i, ColNum).Value = "" Then
Cells(i + 1, ColNum).EntireRow.Hidden = True
Else
Cells(i + 1, ColNum).EntireRow.Hidden = False
End If
Next i
End If
End Sub
Bookmarks