Relatively new to VBA but figuring it out as I go. This forum is an AMAZING resource, so thank you!
I have a piece of code that works on a worksheet if I right click on the worksheet tab, view code, and paste it in. However, I was wondering if there was a way to get this code to work on all worksheets in a workbook without having to go through this copy/paste step. Basically, it unhides rows in a certain range if data is filled in the row above it. This is more of a housekeeping thing than a necessity.
I'm doing a major overhaul of a workbook I made (for myself) that is being used by others. Now 100+ workbooks are already populated with data so all of the coding that I've been working on (learning) to date has been for a single run on multiple workbooks to incorporate some changes that I've been asked to make. This is different and I'm stuck. I've found other coding that is similar but requires manual intervention to run. Please note - I am an accountant, not a programmer or IT person - worksheets are an amazing tool and have become extraordinarily powerful since the Lotus123 days when I was first introduced. I don't want to chase my tail trying to figure this out if it simply isn't possible.
1) Can I modify the below code as a module to run on the active worksheet in a workbook?
2) Can I insert this code into multiple workbooks without opening each one up and importing it?
Thanks in advance for any ideas
I have a piece of code that works on a worksheet if I right click on the worksheet tab, view code, and paste it in. However, I was wondering if there was a way to get this code to work on all worksheets in a workbook without having to go through this copy/paste step. Basically, it unhides rows in a certain range if data is filled in the row above it. This is more of a housekeeping thing than a necessity.
I'm doing a major overhaul of a workbook I made (for myself) that is being used by others. Now 100+ workbooks are already populated with data so all of the coding that I've been working on (learning) to date has been for a single run on multiple workbooks to incorporate some changes that I've been asked to make. This is different and I'm stuck. I've found other coding that is similar but requires manual intervention to run. Please note - I am an accountant, not a programmer or IT person - worksheets are an amazing tool and have become extraordinarily powerful since the Lotus123 days when I was first introduced. I don't want to chase my tail trying to figure this out if it simply isn't possible.
1) Can I modify the below code as a module to run on the active worksheet in a workbook?
2) Can I insert this code into multiple workbooks without opening each one up and importing it?
Thanks in advance for any ideas
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
Application.EnableEvents = False
Dim rng As Range
Set rng = Range("a77:d105")
If Not Intersect(rng, Target) Is Nothing Then
If Target.Value <> "" Then
Target.Offset(1).EntireRow.Hidden = False
Else
End If
End If
Application.EnableEvents = True
End Sub