+ Reply to Thread
Results 1 to 8 of 8

Zellenwert runden in VBA

  1. #1
    Registered User
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    37

    Arrow Zellenwert runden in VBA

    Hi,

    ich bin VBA Anfänger und würde gerne ein Wert in einer Zelle über VBA ansprechend und runden.

    Ich hab mir folgendes überlegt, was aber irgendwie nicht funktioniert:

    Sub round()

    Sheets("Projections").Range("AA5").Value = Application.WorksheetFunction.round

    End Sub
    Es heißt dann: "Argument not optional".

    Wäre super wenn jemand weiterhelfen könnte!

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Zellenwert runden in VBA

    Hallo epione,

    bitte poste in den allgemeinen Foren nur in Englisch. Ich habe Deinen Thread ins Non-English Forum verschoben.

    Es gibt in VBA auch eine Round Funktion. Probier mal dies:
    Please Login or Register  to view this content.
    Gruss

  3. #3
    Registered User
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Zellenwert runden in VBA

    Vielen Dank für die rasche Antwort!!

    Kann ich das application.worksheetfunction immer weglassen? und wann benutze ich denn den präfix "vba" also beispielweise vba.round?


    Und sorry für falsch posten, ganz vergessen!

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Zellenwert runden in VBA

    Application.Worksheetfunction kannst Du benutzen, wenn VBA selbst keine entsprechende Funktion hat, z.B. wenn Du ein CountA() machen möchtest:

    Please Login or Register  to view this content.
    Zum Thema vba.round hab ich keinen Plan, bin selbst noch ziemlich am Anfang mit VBA.

  5. #5
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Zellenwert runden in VBA

    (I leave this to teylyn to translate):
    VBA has a Round function which is different from the Round worksheet function. When you use VBA.Round (or just Round) in code, you are using the VBA version, which uses bankers rounding (to nearest even number); Application.Round or Application.WorksheetFunction.Round uses the ROUND worksheet function, which uses symmetric arithmetic rounding (i.e. .5 rounds up).
    Remember what the dormouse said
    Feed your head

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Zellenwert runden in VBA

    epione, brauchst Du ne Übersetzung?

    Obwohl ich mir ziemlich sicher bin, dass romperstomper das auch alleine hinkriegen würde.

  7. #7
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Zellenwert runden in VBA

    Ich spreche kein Deutsch seit etwa 20 Jahren! Hab' fast das Ganze vergessen.

  8. #8
    Registered User
    Join Date
    01-26-2010
    Location
    london
    MS-Off Ver
    Excel 2007
    Posts
    37

    Re: Zellenwert runden in VBA

    Ich studier in England, also no worries ;-))

    Danke euch!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1