PDA

View Full Version : [SOLVED:] Hide Arrows in Table - Input Box



dj44
06-09-2017, 03:40 PM
folks,

good day

My input box is not working.

I entered the column numbers so i can hide the arrows


i want to hide, but it doesnt seem to work.



Sub Hide_AutoFilter_Arrows()



Dim Lst As ListObject
Dim c As Range
Dim i As Integer
Application.ScreenUpdating = False



Columns_Hide = InputBox("Enter the Column Numbers To Hide the Arrows") ' Separated by Comma

Set Lst = ActiveSheet.ListObjects(1)
i = 1


For Each c In Lst.HeaderRowRange

Select Case i
'Case 1, 2, 3

Case Columns_Hide

Lst.Range.AutoFilter Field:=i, _
Visibledropdown:=False
Case Else
Lst.Range.AutoFilter Field:=i, _
Visibledropdown:=True
End Select
i = i + 1
Next
Application.ScreenUpdating = True



End Sub



it works normally but when i use the input box it doesnt :think:

any ideas?

Paul_Hossler
06-09-2017, 04:05 PM
Columns_Hide is a String variable (="2,4,6,8,10"), so you were basically saying in the Select Case ...

If c = "2,4,6,8,10"

This isn't tested, but something like this maybe




Option Explicit

Sub Hide_AutoFilter_Arrows()
Dim Columns_Hide As String
Dim v As Variant

Dim Lst As ListObject
Dim i As Integer

Application.ScreenUpdating = False

Columns_Hide = InputBox("Enter the Column Numbers To Hide the Arrows") ' Separated by Comma

v = Split(Columns_Hide, ",")

If Not IsArray(v) Then v = Array(v)

Set Lst = ActiveSheet.ListObjects(1)

For i = LBound(v) To UBound(v)
Lst.Range.AutoFilter Field:=i, Visibledropdown:=False
Next I

Application.ScreenUpdating = True

End Sub

mana
06-09-2017, 04:29 PM
Set Lst = ActiveSheet.ListObjects(1)
Lst.Range.AutoFilter
Lst.Range.AutoFilter Field:=v, Visibledropdown:=False

dj44
06-09-2017, 04:33 PM
Hello Paul,

thank you for the full blown array.

I was cheating then trying to use my select case statment

Well i saw a basic example that uses select case and input box so i thought id try that becuase excel puts arrows on eevrything

Well when i see that many arrows i get confused at which column im meant to filter, they are very unsightly

i like to keep things simple as me

let me do some testing :type and i will post back later

and good evening

dj44
06-09-2017, 04:51 PM
Thank you Paul & Mana

for helping make this nice input box work with the Array.


I was very very surprised to find that there was no way for me to disable the arrows :think:

apart from all of them - but i wanted only 1 column so i had to find this vba from somehwere i cant rememeber now
Paul made another one now so thats great :)

thats why i always get stuck, somethings excel dont make easy for the simple people



Every time i had to go find the code and change the columns but now i can eneter the ones i need,
because excel sometimes adds them
its like fighting with an excel poltergeist :grinhalo:


Any way its friday time for a good evening for all.

thanks for the help folks

:beerchug: