online 1
gast (50)

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

Anwendungen(Java,C++...)Anwendungen(Java,C++...)

Fragevon Marodas vom 02.05.2020, 21:42 Options

VBA Code

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


Vielen Dank!

Gruß

Marodas


Antwort schreiben

Antwort 1 von vbexpert vom 02.05.2020, 23:52 Options

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

Ähnliche Themen

Excel schließen (VBA)
Jugo  15.03.2007 - 311 Hits - 1 Antwort

VBA Code eingeben/ wie ?
MaKa  07.10.2007 - 89 Hits -

VBA-Editor öffnen und schließen
maxim66  14.03.2008 - 97 Hits - 2 Antworten

Formel per VBA in Zelle schreiben
Kauz  17.04.2008 - 81 Hits - 2 Antworten

Hinweis

Diese Frage ist schon etwas älter, Sie können daher nicht mehr auf sie antworten. Sollte Ihre Frage noch nicht gelöst sein, stellen Sie einfach eine neue Frage im Forum..

Neue Einträge

Version: supportware 1.9.150 / 10.06.2022, Startzeit:Thu Jan 8 21:07:44 2026