Hi,
I'm fairly new to vb all on my own and have a small understanding of it. I'm in voice engineering so I'm trying to map a sales workbook/form to a hidden tab for building the telephone lines in the switch via .csv, so learning excel was something I didn't expect.
I have read many posts before resorting to a new thread and can't seem to find the proper statements to make this work properly.
The issue is pretty simple. I made buttons to show/hide as many lines as sales reps need to add phone numbers in the fields. The buttons are to simply shorten the fields to condense the large sections I have below it. This is what is created:
Row 15 is where I created the 6 buttons. Row 17 is where I started 'line 1'. So the buttons are
10 lines, 20 lines, 50 lines, 100 lines, 150 lines and finally 200 lines
Click on the 10 Lines button and the function will show only the first 10 lines and hide the other 190. Click again or it will show the rest of them (200).
The button for 10 lines works excellent. I duplicated the similar instructions for the 20 lines but there's a small problem when clicking on one to the other. It will either skip some in between and show the rest or it won't work at all. the buttons have to be clicked in a way to reset them back to show the 200, but they work independently if the 200 are showing from the start.
example:
>all 200 lines showing
>click on the 10 lines button and it's reduced down to 10 rows I need.
>click on the 20 lines button and lines 1-10 show, 11-20 remain hidden, 21-200 show.
>click on the 20 lines button again and only 1-10 show.
I read somewhere that there is no way to overcome this issue without having a 'reset' button to show all the 200. I'd like to think there can be some instruction to have it check to see if any of the lines are hidden, show them all and then carry out what needs to be hidden.
If there's a better way of doing this, I'm all for it. I just want to keep the options there for the sales reps to choose what they need. My code:
----------------------------------------------------------------------------------
Sub TenLinesMacro()
'
' TenLinesMacro Macro
'
'
ActiveWindow.SmallScroll Down:=12
Rows("27:216").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Range("B26").Select
ActiveWindow.SmallScroll Down:=-12
Else
Selection.EntireRow.Hidden = True
Range("B26").Select
ActiveWindow.SmallScroll Down:=-36
End If
End Sub
Sub TwentyLines()
'
' TwentyLines Macro
'
'
ActiveWindow.SmallScroll Down:=12
Rows("37:216").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Range("B26").Select
ActiveWindow.SmallScroll Down:=-12
Else
Selection.EntireRow.Hidden = True
Range("B26").Select
ActiveWindow.SmallScroll Down:=-36
End If
End Sub
----------------------------------------------------------------------------------
Thanks!
- DoctorK
I'm fairly new to vb all on my own and have a small understanding of it. I'm in voice engineering so I'm trying to map a sales workbook/form to a hidden tab for building the telephone lines in the switch via .csv, so learning excel was something I didn't expect.
I have read many posts before resorting to a new thread and can't seem to find the proper statements to make this work properly.
The issue is pretty simple. I made buttons to show/hide as many lines as sales reps need to add phone numbers in the fields. The buttons are to simply shorten the fields to condense the large sections I have below it. This is what is created:
Row 15 is where I created the 6 buttons. Row 17 is where I started 'line 1'. So the buttons are
10 lines, 20 lines, 50 lines, 100 lines, 150 lines and finally 200 lines
Click on the 10 Lines button and the function will show only the first 10 lines and hide the other 190. Click again or it will show the rest of them (200).
The button for 10 lines works excellent. I duplicated the similar instructions for the 20 lines but there's a small problem when clicking on one to the other. It will either skip some in between and show the rest or it won't work at all. the buttons have to be clicked in a way to reset them back to show the 200, but they work independently if the 200 are showing from the start.
example:
>all 200 lines showing
>click on the 10 lines button and it's reduced down to 10 rows I need.
>click on the 20 lines button and lines 1-10 show, 11-20 remain hidden, 21-200 show.
>click on the 20 lines button again and only 1-10 show.
I read somewhere that there is no way to overcome this issue without having a 'reset' button to show all the 200. I'd like to think there can be some instruction to have it check to see if any of the lines are hidden, show them all and then carry out what needs to be hidden.
If there's a better way of doing this, I'm all for it. I just want to keep the options there for the sales reps to choose what they need. My code:
----------------------------------------------------------------------------------
Sub TenLinesMacro()
'
' TenLinesMacro Macro
'
'
ActiveWindow.SmallScroll Down:=12
Rows("27:216").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Range("B26").Select
ActiveWindow.SmallScroll Down:=-12
Else
Selection.EntireRow.Hidden = True
Range("B26").Select
ActiveWindow.SmallScroll Down:=-36
End If
End Sub
Sub TwentyLines()
'
' TwentyLines Macro
'
'
ActiveWindow.SmallScroll Down:=12
Rows("37:216").Select
If Selection.EntireRow.Hidden = True Then
Selection.EntireRow.Hidden = False
Range("B26").Select
ActiveWindow.SmallScroll Down:=-12
Else
Selection.EntireRow.Hidden = True
Range("B26").Select
ActiveWindow.SmallScroll Down:=-36
End If
End Sub
----------------------------------------------------------------------------------
Thanks!
- DoctorK