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.

Empfohlene Antworten

Veröffentlicht

Hallo Leute. Ich bin Fisi und muss ein Visual Basic Excel Makro schreiben.

Es geht darum zu Produkten anhand von Produkt-Nummer das zugehörig Bild einzufügen.

Mein Makro funktioniert auch, aber ich wollte noch eine manuelle Selektion einfügen, dass nur für die manuell ausgewählten Produktnummern die Bilder eingefügt werden,

da ich leider keine Ahnung von VBA habe. Habe ich es mir zusammen geschustert.

 

Danke im Voraus!!

hier der funktionierende Code.

 

Private Sub CommandButton1_Click()
Dim i As Integer
    For i = 2 To 10000
Dim strpath As String
strpath = "C:\Bilder\"
    If ActiveSheet.Range("B" & i).Value > 0 Then
    On Error Resume Next
    ActiveSheet.Range("A" & i).Select
    Set Zelle = ActiveCell
        If Not Dir(strpath & Range("B" & i).Value & ".JPG") = "" Then
        Set Bild = ActiveSheet.Pictures.Insert(strpath & Range("B" & i).Value & ".JPG")
        With Bild
        .Placement = 2
        .Left = Zelle.Left
        .Top = Zelle.Top
        .Width = Zelle.Height
        .Height = Zelle.Height
        End With
        End If
    End If
    Next
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

 

Hier der Code der nicht geht, habe das hier verwendet: http://www.supportnet.de/fresh/2005/4/id1049238.asp

 

Private Sub CommandButton1_Click()
Dim i As Integer
    For i = 2 To 10000
Dim strpath As String
Dim rngBer As Range
strpath = "C:\Bilder\"
    Set rngBer = Application.InputBox _
    (prompt:="Bereich eingeben oder mit Maus auswählen", Type:=8)
    If ActiveSheet.Range("rngBer" & i).Value > 0 Then
    On Error Resume Next
    ActiveSheet.Range("A" & i).Select
    Set Zelle = ActiveCell
        If Not Dir(strpath & Range("rngber" & i).Value & ".JPG") = "" Then
        Set Bild = ActiveSheet.Pictures.Insert(strpath & Range("rngBer" & i).Value & ".JPG")
        With Bild
        .Placement = 2
        .Left = Zelle.Left
        .Top = Zelle.Top
        .Width = Zelle.Height
        .Height = Zelle.Height
        End With
        End If
    End If
    Next
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

End Sub

 

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.