Hi, my problem is that I have a worksheet that multiple users have input to & in the tables are formulas etc & my code will not work due to the formulas. I need the tables locked so the user can only enter data into the cells that I want. P.s there are muliple tables in the worksheet so I cant have the table rows increasing in number.
Long story short......Can I hide / unhide rows depending if col 1 is empty or not (using a command button)?
Sub Sort_HideRows()
Range("Mod_4T1[#All]").Select
ActiveWorkbook.Worksheets("4.75 SAS").ListObjects("Mod_4T1").Sort.SortFields. _
Clear
ActiveWorkbook.Worksheets("4.75 SAS").ListObjects("Mod_4T1").Sort.SortFields. _
Add Key:=Range("Mod_4T1[4¾ Mod Stab]"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("4.75 SAS").ListObjects("Mod_4T1").Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
Range("B3").Select
Dim Rng As Range
Set Rng = Range("Mod_4T1")
For i = Rng.Rows.Count To 1 Step -1
If WorksheetFunction.CountA(Rng.Rows(i)) = 0 Then
Rng.Rows(i).EntireRow.Hidden = True
End If
Next i
Application.ScreenUpdating = True
End Sub
Bookmarks