Supportnet Computer
Planet of Tech

Supportnet / Forum / Anwendungen(Java,C++...)

VBA Code





Frage

Hallo, kann mir jemand diesen Code erklären? Ich verstehe ihn nicht! Sub aaa() Application.ScreenUpdating = False If Range("A1:A10").EntireRow.Hidden = True Then Range("A1:A10").EntireRow.Hidden = False Else Range("A1:A10").EntireRow.Hidden = True If Range("A1:A10").EntireRow.Hidden = True Then Sheets("tabelle1").Select Range("A15").Select ActiveCell.FormulaR1C1 = "ein" Sheets("tabelle1").Select Application.ScreenUpdating = True Range("A6").Select Else Sheets("tabelle1").Select Range("A15").Select ActiveCell.FormulaR1C1 = "aus" Sheets("tabelle1").Select Application.ScreenUpdating = True Range("A1").Select End If End Sub[code][/code][code] Vielen Dank! Gruß Marodas

Antwort 1 von vbexpert

I wouldn't say one way is completely superior to the other. But the first method is definately cleaner, easier to write and more streamlined. Not necessarily easier to understand....I remember the first time I saw that done, it made my head go in circles for a few minutes until I understood it But it won't work in EVERY situation...
It only works if you're setting a TRUE/FALSE value based on another TRUE/FALSE value.

For example, If you want to set a Text Value based on a TRUE/FALSE, you can't do it that way.
like
Code:
Zitat:

If rCell.Value <= 5 Then
MyVarible = "Barney"
Else:
MyVariable = "Fred"
End If

There would be no way to do it with the Implied If

Ich möchte kostenlos eine Frage an die Mitglieder stellen:


Ähnliche Themen:


Suche in allen vorhandenen Beiträgen: