Adding Auto unhide rows to my worksheet change code

anichols

Board Regular
Joined
Mar 11, 2021
Messages
87
Office Version
  1. 365
Platform
  1. Windows
Hello all,

I have a worksheet change code that will input the date, time, and users name into the log that they are working on, My challenge is that I am trying to automatically unhide the next row after input has been entered into column b of the last row filled in. I've found some options to hide or unhide all blanks, but that doesn't quite help me. Any assistance would be greatly appreciated.

VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim WorkRng As Range
Dim Rng As Range
Dim xOffsetColumn As Integer: Dim xOffsetColumn2 As Integer: Dim xOffsetColumn3 As Integer
Set WorkRng = Intersect(Application.ActiveSheet.Range("B9:B100000"), Target)
xOffsetColumn = 7
xOffsetColumn2 = 8
xOffsetColumn3 = 9
If Not WorkRng Is Nothing Then
    Application.EnableEvents = False
    For Each Rng In WorkRng
        If Not VBA.IsEmpty(Rng.Value) Then
            Rng.Offset(0, xOffsetColumn).Value = Now
            Rng.Offset(0, xOffsetColumn).NumberFormat = "mm/dd/yyyy"
            Rng.Offset(0, xOffsetColumn2).Value = Now
            Rng.Offset(0, xOffsetColumn2).NumberFormat = "hh:mm:ss"
            Rng.Offset(0, xOffsetColumn3).Value = Sheets("SECRET").Range("F4").Value
        Else
            Rng.Offset(0, xOffsetColumn).ClearContents
            Rng.Offset(0, xOffsetColumn2).ClearContents
            Rng.Offset(0, xOffsetColumn3).ClearContents
        End If
    Next
    Application.EnableEvents = True
End If

End Sub

Thanks - Drew!
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Give this line a try. The row after the last cell changed will be unhidden:
Target.Offset(1, 0).EntireRow.Hidden = False
 
Upvote 0
Solution

Forum statistics

Threads
1,224,800
Messages
6,181,045
Members
453,014
Latest member
Chris258

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top