Consulting

Results 1 to 2 of 2

Thread: VBA Suchen und Ersetzen

  1. #1

    VBA Suchen und Ersetzen

    Hallo zusammen,

    WENN ICH Anstätt Zellenverweis Zahlen verwende Geht der Kodex.

    ICH müsste hier Aber einen Verweis zellen ersetzen. Hat hier Jemand EINE Idee ?



    Sub tst ()
    Dim r As Range Mit Sheets ("Kalkulation Stammdaten")
    Set r = .Range ("M1: M1000")
    r.Replace War: = "! Eingabemaske $ P $ 7", Ersatz :. = Range ("K2") Wert, LookAt :. = XlPart
    r.Replace War: =, Ersatz "Eingabemaske $ P $ 8!": .. = Range ("K3") Wert, LookAt: = xlPart
    r.Replace War: "Eingabemaske $ P $ 9" =, Ersatz :. = Range ("K4") Wert, LookAt :. = XlPart
    End Mit
    End Sub sterben formeln variieren Immer. Nur der Zellenbezug IST Gleich. Bsp. = Eingabemaske! $ P $ 7 * 0,49 / 1000 = Eingabemaske! $ P $ 7 * 0,14 / 784 = Eingabemaske! $ P $ 7 * 0,98452 / 452 ICH danke Euch für Den Rat





























  2. #2
    VBAX Regular HaHoBe's Avatar
    Joined
    Aug 2004
    Location
    Hamburg
    Posts
    89
    Location
    Hallo, AndreasBess,

    Du solltest vilelicht in einem englisch-sprachigen Forum die Frage auf englisch stellen, wenn Du zeitnah eine Antowrt erhalten möchtest.

    VBA spricht ebenso wie ein Großteil der Teilnehmer an diesem Forum englisch, und mölglicherweise solltest Du per Makro-Rekorder die Schritte aufzeichnen, um eine Grundlage für den Code und die Anweisungen zu erhalten.

    Den Satz nach dem End Sub habe ich leider nicht verstanden und kann ihn daher auch nicht im Code umsetzen

    ---
    Hi, Andreas,

    you should consiuder that most participanmts of VBA Express are people who understand english but only a small percentage will care to answer to a thread in German.

    Same goes for most of the keywords that are being used in VBA Code: they are in english and you would need them in that way to work. Maybe it would be a good idea to record some basic features with the macro-recorder turned on and have a look at the code which is produced (it could be worked on to be more efficient).

    Sorry I didn´t get the meaning of the words after the End Sub so I´m afraid I couldn´t code for that.

    Sub tst()
    Dim r As Range
    Set r = Sheets("Kalkulation Stammdaten").Range("M1:M1000")
    
    With Sheets("Eingabemaske")
      r.Replace What:=.Range("P7").Value, Replace:=.Range("K2").Value, LookAt:=xlPart
      r.Replace What:=.Range("P8").Value, Replace:=.Range("K3").Value, LookAt:=xlPart
      r.Replace What:=.Range("P9").Value, Replace:=.Range("K4").Value, LookAt:=xlPart
    End With
    
    Set r = Nothing
    
    End Sub
    Sub tst_Loop()
    Dim r As Range
    Dim lngLoop As Long
    
    Set r = Sheets("Kalkulation Stammdaten").Range("M1:M1000")
    
    With Sheets("Eingabemaske")
      For lngLoop = 7 To 9
        r.Replace What:=.Range("P" & lngLoop).Value, Replace:=.Range("K" & lngLoop - 5).Value, LookAt:=xlPart
      Next lngLoop
    End With
    
    Set r = Nothing
    
    End Sub
    HTH,
    Holger

Posting Permissions

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