SpectreHUN
New Member
- Joined
- Aug 15, 2014
- Messages
- 14
So I have a Sheet, where I want to show only the data which is relevant based on the user's selection in the drop-down list (G3). My code so-far:
It works, but it's not automatic. I have to manually run the macro every time there is a change in G3. Any help would be appreciated!
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("G3")) Is Nothing Then
Application.Run "HideRows"
End If
End Sub
Sub HideRows()
On Error Resume Next
LTRW = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To LTRW
If Cells(i, 7).Value = "Import" Then
For j = 60 To 82
Cells(j, 20).EntireRow.Hidden = True
Next j
End If
If Cells(i, 7).Value = "Közösségen belüli beszerzés" Then
For j = 60 To 82
Cells(j, 20).EntireRow.Hidden = False
Next j
End If
Next i
End Sub
It works, but it's not automatic. I have to manually run the macro every time there is a change in G3. Any help would be appreciated!