Searching and sorting ranges in excel with toggle buttons Announcing the arrival of Valued...

What is the longest distance a 13th-level monk can jump while attacking on the same turn?

Why aren't air breathing engines used as small first stages

Stars Make Stars

Should I discuss the type of campaign with my players?

Is 1 ppb equal to 1 μg/kg?

Is the Standard Deduction better than Itemized when both are the same amount?

What does the "x" in "x86" represent?

What is the correct way to use the pinch test for dehydration?

How can I fade player when goes inside or outside of the area?

3 doors, three guards, one stone

Why does Python start at index -1 when indexing a list from the end?

When -s is used with third person singular. What's its use in this context?

Sorting numerically

Do you forfeit tax refunds/credits if you aren't required to and don't file by April 15?

ListPlot join points by nearest neighbor rather than order

Is high blood pressure ever a symptom attributable solely to dehydration?

How much radiation do nuclear physics experiments expose researchers to nowadays?

Did Xerox really develop the first LAN?

How to bypass password on Windows XP account?

Can Pao de Queijo, and similar foods, be kosher for Passover?

Gastric acid as a weapon

Right-skewed distribution with mean equals to mode?

Check which numbers satisfy the condition [A*B*C = A! + B! + C!]

Letter Boxed validator



Searching and sorting ranges in excel with toggle buttons



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Displaying plotted data in serpentine orderCleaning up and reformatting imported data in an Excel sheetMatching between files and a list of filenames at scaleStandard Methods in VBAAggregating data from multiple worksheets into a consistent formatForecast maintenance interval for fleet of aircraftMaking a report from payroll detailsSlow VBA macro using nested loops and autofilter to consolidate select data from 2 worksheets into 1VSTO add-in for Excel to solve systems of linear equationsFastest method of getting the bounding box containing all value ranges





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1












$begingroup$


I have a spreadsheet containing ±100 named ranges (5 rows, 15 colums) which are sorted based on time.



My plan was to make toggle buttons to hide or unhide named ranges when they contain a certain value.



So when I select the toggle button for 'Opel' for instance, all the named ranges containing 'Opel' are displayed. And when I select 'Opel' and 'Ford. All the ranges containing 'Opel' and 'Ford' are displayed while also being able to sort the ranges in that view.



For the sorting I use the following code:



Sub SorterenOpdrachten()

Dim Detail As Worksheet
Dim I As Long
Dim ListRng As Range
Dim LijstWks As Worksheet
Dim NamedRng As Name
Dim R As Long
Dim Rng As Range
Dim SortWks As Worksheet


'Worksheet declareren als variabele
Set Detail = Worksheets("detail")
Set LijstWks = Worksheets("LijstWks")
Set SortWks = Worksheets("SortWks")

'Startrij voor de lijst instellen = Rij 1 fungeert als "hoofding"
R = 2



'Ranges naar lijst kopiëren - Opdracht en uur
For Each NamedRng In ActiveWorkbook.Names



LijstWks.Cells(R, 1) = NamedRng.Name
LijstWks.Cells(R, 2) = NamedRng.RefersToRange.Cells(1, 2)
R = R + 1
Next NamedRng

'Ranges sorteren in de lijst
R = R - 1
Set ListRng = LijstWks.Range("A2").Resize(R - 1, 2)
ListRng.Sort Key1:=ListRng.Cells(1, 2), Order1:=xlAscending


'Ranges kopiëren naar SortWks
R = 1
For I = 1 To ListRng.Rows.Count
Set Rng = ActiveWorkbook.Names(ListRng.Cells(I, 1).Text).RefersToRange
Rng.Copy
SortWks.Cells(R, 1).PasteSpecial Paste:=xlPasteAll
R = R + Rng.Rows.Count
Next I

'Opdrachten naar detail kopiëren
R = 1
Worksheets("SortWks").Range("A1:T499").Copy
Worksheets("detail").Range("A5:T504")

Next intCounter
End Sub


This works fine.



But when I use it in combination with the toggle buttons it is too slow.



For the toggle buttons I use the following code:



Sub Tegels()

Dim nm As Name

For Each nm In Application.Names
Range(nm).EntireRow.Hidden = True
Next nm


If TglOpel Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Opel" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglChevrolet Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Chevrolet" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglFord Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Ford" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglBuick Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Buick" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglDodge Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Dodge" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If


End Sub


Sub CheckTegels()

If TglOpel Then
Call Tegels
Exit Sub
Else
If TglChevrolet Then
Call Tegels
Exit Sub
Else
If TglFord Then
Call Tegels
Exit Sub
Else
If TglBuick Then
Call Tegels
Exit Sub
Else
If TglDodge Then
Call Tegels
Exit Sub
Else

Dim nm As Name

For Each nm In Application.Names
Range(nm).EntireRow.Hidden = False
Next nm


End If
End If
End If
End If
End If
End If
End If
End If
End Sub


Do you have any tips for speeding this process up?



As you can probably tell I am quite new to this. Any help would be greatly appreciated!










share|improve this question











$endgroup$




bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1




    $begingroup$
    You need a RubberDuck. RubberDuck is a VBE add-in project that had a ton of features. Using its Code Formatter will not only improve the readability of your code but will help catch errors when code blocks are not opened and closed properly.
    $endgroup$
    – user109261
    Jan 4 '18 at 13:20










  • $begingroup$
    You need to post your complete code. As stated previously, you should also format your code.
    $endgroup$
    – user109261
    Jan 8 '18 at 10:37










  • $begingroup$
    You will get better performance if you unhide all the cells first. Next you should Union the ranges to be hidden and hide them all at once. Here are a few tips that will help Excel VBA Speed and Efficiency
    $endgroup$
    – user109261
    Jan 8 '18 at 10:40


















1












$begingroup$


I have a spreadsheet containing ±100 named ranges (5 rows, 15 colums) which are sorted based on time.



My plan was to make toggle buttons to hide or unhide named ranges when they contain a certain value.



So when I select the toggle button for 'Opel' for instance, all the named ranges containing 'Opel' are displayed. And when I select 'Opel' and 'Ford. All the ranges containing 'Opel' and 'Ford' are displayed while also being able to sort the ranges in that view.



For the sorting I use the following code:



Sub SorterenOpdrachten()

Dim Detail As Worksheet
Dim I As Long
Dim ListRng As Range
Dim LijstWks As Worksheet
Dim NamedRng As Name
Dim R As Long
Dim Rng As Range
Dim SortWks As Worksheet


'Worksheet declareren als variabele
Set Detail = Worksheets("detail")
Set LijstWks = Worksheets("LijstWks")
Set SortWks = Worksheets("SortWks")

'Startrij voor de lijst instellen = Rij 1 fungeert als "hoofding"
R = 2



'Ranges naar lijst kopiëren - Opdracht en uur
For Each NamedRng In ActiveWorkbook.Names



LijstWks.Cells(R, 1) = NamedRng.Name
LijstWks.Cells(R, 2) = NamedRng.RefersToRange.Cells(1, 2)
R = R + 1
Next NamedRng

'Ranges sorteren in de lijst
R = R - 1
Set ListRng = LijstWks.Range("A2").Resize(R - 1, 2)
ListRng.Sort Key1:=ListRng.Cells(1, 2), Order1:=xlAscending


'Ranges kopiëren naar SortWks
R = 1
For I = 1 To ListRng.Rows.Count
Set Rng = ActiveWorkbook.Names(ListRng.Cells(I, 1).Text).RefersToRange
Rng.Copy
SortWks.Cells(R, 1).PasteSpecial Paste:=xlPasteAll
R = R + Rng.Rows.Count
Next I

'Opdrachten naar detail kopiëren
R = 1
Worksheets("SortWks").Range("A1:T499").Copy
Worksheets("detail").Range("A5:T504")

Next intCounter
End Sub


This works fine.



But when I use it in combination with the toggle buttons it is too slow.



For the toggle buttons I use the following code:



Sub Tegels()

Dim nm As Name

For Each nm In Application.Names
Range(nm).EntireRow.Hidden = True
Next nm


If TglOpel Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Opel" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglChevrolet Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Chevrolet" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglFord Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Ford" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglBuick Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Buick" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglDodge Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Dodge" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If


End Sub


Sub CheckTegels()

If TglOpel Then
Call Tegels
Exit Sub
Else
If TglChevrolet Then
Call Tegels
Exit Sub
Else
If TglFord Then
Call Tegels
Exit Sub
Else
If TglBuick Then
Call Tegels
Exit Sub
Else
If TglDodge Then
Call Tegels
Exit Sub
Else

Dim nm As Name

For Each nm In Application.Names
Range(nm).EntireRow.Hidden = False
Next nm


End If
End If
End If
End If
End If
End If
End If
End If
End Sub


Do you have any tips for speeding this process up?



As you can probably tell I am quite new to this. Any help would be greatly appreciated!










share|improve this question











$endgroup$




bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1




    $begingroup$
    You need a RubberDuck. RubberDuck is a VBE add-in project that had a ton of features. Using its Code Formatter will not only improve the readability of your code but will help catch errors when code blocks are not opened and closed properly.
    $endgroup$
    – user109261
    Jan 4 '18 at 13:20










  • $begingroup$
    You need to post your complete code. As stated previously, you should also format your code.
    $endgroup$
    – user109261
    Jan 8 '18 at 10:37










  • $begingroup$
    You will get better performance if you unhide all the cells first. Next you should Union the ranges to be hidden and hide them all at once. Here are a few tips that will help Excel VBA Speed and Efficiency
    $endgroup$
    – user109261
    Jan 8 '18 at 10:40














1












1








1





$begingroup$


I have a spreadsheet containing ±100 named ranges (5 rows, 15 colums) which are sorted based on time.



My plan was to make toggle buttons to hide or unhide named ranges when they contain a certain value.



So when I select the toggle button for 'Opel' for instance, all the named ranges containing 'Opel' are displayed. And when I select 'Opel' and 'Ford. All the ranges containing 'Opel' and 'Ford' are displayed while also being able to sort the ranges in that view.



For the sorting I use the following code:



Sub SorterenOpdrachten()

Dim Detail As Worksheet
Dim I As Long
Dim ListRng As Range
Dim LijstWks As Worksheet
Dim NamedRng As Name
Dim R As Long
Dim Rng As Range
Dim SortWks As Worksheet


'Worksheet declareren als variabele
Set Detail = Worksheets("detail")
Set LijstWks = Worksheets("LijstWks")
Set SortWks = Worksheets("SortWks")

'Startrij voor de lijst instellen = Rij 1 fungeert als "hoofding"
R = 2



'Ranges naar lijst kopiëren - Opdracht en uur
For Each NamedRng In ActiveWorkbook.Names



LijstWks.Cells(R, 1) = NamedRng.Name
LijstWks.Cells(R, 2) = NamedRng.RefersToRange.Cells(1, 2)
R = R + 1
Next NamedRng

'Ranges sorteren in de lijst
R = R - 1
Set ListRng = LijstWks.Range("A2").Resize(R - 1, 2)
ListRng.Sort Key1:=ListRng.Cells(1, 2), Order1:=xlAscending


'Ranges kopiëren naar SortWks
R = 1
For I = 1 To ListRng.Rows.Count
Set Rng = ActiveWorkbook.Names(ListRng.Cells(I, 1).Text).RefersToRange
Rng.Copy
SortWks.Cells(R, 1).PasteSpecial Paste:=xlPasteAll
R = R + Rng.Rows.Count
Next I

'Opdrachten naar detail kopiëren
R = 1
Worksheets("SortWks").Range("A1:T499").Copy
Worksheets("detail").Range("A5:T504")

Next intCounter
End Sub


This works fine.



But when I use it in combination with the toggle buttons it is too slow.



For the toggle buttons I use the following code:



Sub Tegels()

Dim nm As Name

For Each nm In Application.Names
Range(nm).EntireRow.Hidden = True
Next nm


If TglOpel Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Opel" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglChevrolet Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Chevrolet" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglFord Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Ford" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglBuick Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Buick" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglDodge Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Dodge" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If


End Sub


Sub CheckTegels()

If TglOpel Then
Call Tegels
Exit Sub
Else
If TglChevrolet Then
Call Tegels
Exit Sub
Else
If TglFord Then
Call Tegels
Exit Sub
Else
If TglBuick Then
Call Tegels
Exit Sub
Else
If TglDodge Then
Call Tegels
Exit Sub
Else

Dim nm As Name

For Each nm In Application.Names
Range(nm).EntireRow.Hidden = False
Next nm


End If
End If
End If
End If
End If
End If
End If
End If
End Sub


Do you have any tips for speeding this process up?



As you can probably tell I am quite new to this. Any help would be greatly appreciated!










share|improve this question











$endgroup$




I have a spreadsheet containing ±100 named ranges (5 rows, 15 colums) which are sorted based on time.



My plan was to make toggle buttons to hide or unhide named ranges when they contain a certain value.



So when I select the toggle button for 'Opel' for instance, all the named ranges containing 'Opel' are displayed. And when I select 'Opel' and 'Ford. All the ranges containing 'Opel' and 'Ford' are displayed while also being able to sort the ranges in that view.



For the sorting I use the following code:



Sub SorterenOpdrachten()

Dim Detail As Worksheet
Dim I As Long
Dim ListRng As Range
Dim LijstWks As Worksheet
Dim NamedRng As Name
Dim R As Long
Dim Rng As Range
Dim SortWks As Worksheet


'Worksheet declareren als variabele
Set Detail = Worksheets("detail")
Set LijstWks = Worksheets("LijstWks")
Set SortWks = Worksheets("SortWks")

'Startrij voor de lijst instellen = Rij 1 fungeert als "hoofding"
R = 2



'Ranges naar lijst kopiëren - Opdracht en uur
For Each NamedRng In ActiveWorkbook.Names



LijstWks.Cells(R, 1) = NamedRng.Name
LijstWks.Cells(R, 2) = NamedRng.RefersToRange.Cells(1, 2)
R = R + 1
Next NamedRng

'Ranges sorteren in de lijst
R = R - 1
Set ListRng = LijstWks.Range("A2").Resize(R - 1, 2)
ListRng.Sort Key1:=ListRng.Cells(1, 2), Order1:=xlAscending


'Ranges kopiëren naar SortWks
R = 1
For I = 1 To ListRng.Rows.Count
Set Rng = ActiveWorkbook.Names(ListRng.Cells(I, 1).Text).RefersToRange
Rng.Copy
SortWks.Cells(R, 1).PasteSpecial Paste:=xlPasteAll
R = R + Rng.Rows.Count
Next I

'Opdrachten naar detail kopiëren
R = 1
Worksheets("SortWks").Range("A1:T499").Copy
Worksheets("detail").Range("A5:T504")

Next intCounter
End Sub


This works fine.



But when I use it in combination with the toggle buttons it is too slow.



For the toggle buttons I use the following code:



Sub Tegels()

Dim nm As Name

For Each nm In Application.Names
Range(nm).EntireRow.Hidden = True
Next nm


If TglOpel Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Opel" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglChevrolet Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Chevrolet" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglFord Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Ford" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglBuick Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Buick" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If

If TglDodge Then
For Each nm In Application.Names
If Application.CountIf(Range(nm), "*" & "Dodge" & "*") Then
Range(nm).EntireRow.Hidden = False
Next nm
End If


End Sub


Sub CheckTegels()

If TglOpel Then
Call Tegels
Exit Sub
Else
If TglChevrolet Then
Call Tegels
Exit Sub
Else
If TglFord Then
Call Tegels
Exit Sub
Else
If TglBuick Then
Call Tegels
Exit Sub
Else
If TglDodge Then
Call Tegels
Exit Sub
Else

Dim nm As Name

For Each nm In Application.Names
Range(nm).EntireRow.Hidden = False
Next nm


End If
End If
End If
End If
End If
End If
End If
End If
End Sub


Do you have any tips for speeding this process up?



As you can probably tell I am quite new to this. Any help would be greatly appreciated!







sorting vba excel interval






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 21 '18 at 22:07









Sᴀᴍ Onᴇᴌᴀ

10.6k62168




10.6k62168










asked Jan 4 '18 at 11:31









TommyTommy

62




62





bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 6 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 1




    $begingroup$
    You need a RubberDuck. RubberDuck is a VBE add-in project that had a ton of features. Using its Code Formatter will not only improve the readability of your code but will help catch errors when code blocks are not opened and closed properly.
    $endgroup$
    – user109261
    Jan 4 '18 at 13:20










  • $begingroup$
    You need to post your complete code. As stated previously, you should also format your code.
    $endgroup$
    – user109261
    Jan 8 '18 at 10:37










  • $begingroup$
    You will get better performance if you unhide all the cells first. Next you should Union the ranges to be hidden and hide them all at once. Here are a few tips that will help Excel VBA Speed and Efficiency
    $endgroup$
    – user109261
    Jan 8 '18 at 10:40














  • 1




    $begingroup$
    You need a RubberDuck. RubberDuck is a VBE add-in project that had a ton of features. Using its Code Formatter will not only improve the readability of your code but will help catch errors when code blocks are not opened and closed properly.
    $endgroup$
    – user109261
    Jan 4 '18 at 13:20










  • $begingroup$
    You need to post your complete code. As stated previously, you should also format your code.
    $endgroup$
    – user109261
    Jan 8 '18 at 10:37










  • $begingroup$
    You will get better performance if you unhide all the cells first. Next you should Union the ranges to be hidden and hide them all at once. Here are a few tips that will help Excel VBA Speed and Efficiency
    $endgroup$
    – user109261
    Jan 8 '18 at 10:40








1




1




$begingroup$
You need a RubberDuck. RubberDuck is a VBE add-in project that had a ton of features. Using its Code Formatter will not only improve the readability of your code but will help catch errors when code blocks are not opened and closed properly.
$endgroup$
– user109261
Jan 4 '18 at 13:20




$begingroup$
You need a RubberDuck. RubberDuck is a VBE add-in project that had a ton of features. Using its Code Formatter will not only improve the readability of your code but will help catch errors when code blocks are not opened and closed properly.
$endgroup$
– user109261
Jan 4 '18 at 13:20












$begingroup$
You need to post your complete code. As stated previously, you should also format your code.
$endgroup$
– user109261
Jan 8 '18 at 10:37




$begingroup$
You need to post your complete code. As stated previously, you should also format your code.
$endgroup$
– user109261
Jan 8 '18 at 10:37












$begingroup$
You will get better performance if you unhide all the cells first. Next you should Union the ranges to be hidden and hide them all at once. Here are a few tips that will help Excel VBA Speed and Efficiency
$endgroup$
– user109261
Jan 8 '18 at 10:40




$begingroup$
You will get better performance if you unhide all the cells first. Next you should Union the ranges to be hidden and hide them all at once. Here are a few tips that will help Excel VBA Speed and Efficiency
$endgroup$
– user109261
Jan 8 '18 at 10:40










1 Answer
1






active

oldest

votes


















0












$begingroup$

Some basic things. You need your code to be indented consistently. That way you can see the levels of your code. If you had that you would see that on the last line of SorterenOpdrachten is a Next without a For. This won't compile.



In Tegels you have missed your first End If. And the second End If. And your third, fourth and fifth.



You haven't defined tglopel or TglChevrolet






share|improve this answer









$endgroup$














    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "196"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f184272%2fsearching-and-sorting-ranges-in-excel-with-toggle-buttons%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0












    $begingroup$

    Some basic things. You need your code to be indented consistently. That way you can see the levels of your code. If you had that you would see that on the last line of SorterenOpdrachten is a Next without a For. This won't compile.



    In Tegels you have missed your first End If. And the second End If. And your third, fourth and fifth.



    You haven't defined tglopel or TglChevrolet






    share|improve this answer









    $endgroup$


















      0












      $begingroup$

      Some basic things. You need your code to be indented consistently. That way you can see the levels of your code. If you had that you would see that on the last line of SorterenOpdrachten is a Next without a For. This won't compile.



      In Tegels you have missed your first End If. And the second End If. And your third, fourth and fifth.



      You haven't defined tglopel or TglChevrolet






      share|improve this answer









      $endgroup$
















        0












        0








        0





        $begingroup$

        Some basic things. You need your code to be indented consistently. That way you can see the levels of your code. If you had that you would see that on the last line of SorterenOpdrachten is a Next without a For. This won't compile.



        In Tegels you have missed your first End If. And the second End If. And your third, fourth and fifth.



        You haven't defined tglopel or TglChevrolet






        share|improve this answer









        $endgroup$



        Some basic things. You need your code to be indented consistently. That way you can see the levels of your code. If you had that you would see that on the last line of SorterenOpdrachten is a Next without a For. This won't compile.



        In Tegels you have missed your first End If. And the second End If. And your third, fourth and fifth.



        You haven't defined tglopel or TglChevrolet







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 21 '18 at 21:47









        RaystafarianRaystafarian

        5,86911049




        5,86911049






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Code Review Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f184272%2fsearching-and-sorting-ranges-in-excel-with-toggle-buttons%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Fairchild Swearingen Metro Inhaltsverzeichnis Geschichte | Innenausstattung | Nutzung | Zwischenfälle...

            Pilgersdorf Inhaltsverzeichnis Geografie | Geschichte | Bevölkerungsentwicklung | Politik | Kultur...

            Marineschifffahrtleitung Inhaltsverzeichnis Geschichte | Heutige Organisation der NATO | Nationale und...