Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Excel VBA - Zellenformel in Makro integrieren

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

Habe folgendes Problem:

Ich habe ein Excel file mit Daten im 1. Sheet. Danach führe ich ein Makro aus dass diese Daten auf mehere Sheets verteilt. So weit so gut ;)

Nun möchte ich in das bestehende Makro zusätzlich folgende Dinge integrieren:

in alle Sheets ausser dem ersten (Quell-sheet) soll es in die Zelle "I1" den Header "Total" einfügen und in die Zelle "I2" folgende Formel einfügen:

=VLOOKUP(MID(CELL("filename");FIND("]";CELL("filename"))+1;99)*1;'O:\Total\[Total.xls]Total'!$B$4:$D$525;3;0)

Hier mein Code:

Sub Macro1()

Dim i As Integer

Dim e As Integer


Dim Sht As Worksheet

Set Sht = Sheets("Sheet1") 'ANPASSEN


e = 1

For i = 1 To Sht.UsedRange.Rows.Count

If Left(Sht.Range("A" & i), 1) = "*" Then

Sheets.Add after:=Sheets(Sheets.Count)

ActiveSheet.Name = Mid(Sht.Range("A" & i), 3, 40)

Columns("A:G").Select

Selection.ColumnWidth = 12

    With Selection

        .HorizontalAlignment = xlRight

        .VerticalAlignment = xlBottom

        .WrapText = False

        .Orientation = 0

        .AddIndent = False

        .ShrinkToFit = False

        .MergeCells = False

    End With

e = 1


ElseIf Left(Sht.Range("A" & i), 1) <> "*" Then

ActiveSheet.Range("A" & e) = Sht.Range("A" & i)

ActiveSheet.Range("B" & e) = Sht.Range("B" & i)

ActiveSheet.Range("C" & e) = Sht.Range("C" & i)

ActiveSheet.Range("D" & e) = Sht.Range("D" & i)

ActiveSheet.Range("E" & e) = Sht.Range("E" & i)

ActiveSheet.Range("F" & e) = Sht.Range("F" & i)

ActiveSheet.Range("G" & e) = Sht.Range("G" & i)

e = e + 1

End If

Next i

End Sub

Ich denke am besten geht das wenn der Code vor der Zeile "e = e + 1" modifiziert wird.

Wäre dir für eine Hilfestellung sehr dankbar ;)

Grüsse

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.