frans kooijman
Gebruiker
- Lid geworden
- 22 apr 2008
- Berichten
- 539
Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
Privacywetgeving
Het is bij Helpmij.nl niet toegestaan om persoonsgegevens in een voorbeeld te plaatsen. Alle voorbeelden die persoonsgegevens bevatten zullen zonder opgaaf van reden verwijderd worden. In de vraag zal specifiek vermeld moeten worden dat het om fictieve namen gaat.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 And Target.Value > 15 And LCase(Target.Offset(, -1)) = "marie" Then Target.AddComment "aantal is correct"
End Sub
Sub VoegFotoToeAanAlleSKU()
Dim sku As String
Dim fotoPad As String
Dim ws As Worksheet
Dim cel As Range
Dim shp As Shape
Dim note As Comment
' Vraag SKU
sku = InputBox("Welk SKU-nummer wil je koppelen aan een foto?", "SKU foto")
If Trim(sku) = "" Then Exit Sub
' Vraag foto
With Application.FileDialog(msoFileDialogFilePicker)
.Title = "Selecteer een foto voor SKU " & sku
.Filters.Add "Foto", "*.jpg; *.jpeg; *.png"
.AllowMultiSelect = False
If .Show <> -1 Then Exit Sub
fotoPad = .SelectedItems(1)
End With
' Tijdelijke shape voor afmetingen
Set shp = ActiveSheet.Shapes.AddPicture(fotoPad, msoFalse, msoTrue, 0, 0, -1, -1)
shp.LockAspectRatio = msoTrue
shp.Height = 200
' Door alle sheets heen
For Each ws In ThisWorkbook.Worksheets
' Door alle gebruikte cellen heen
For Each cel In ws.UsedRange
If Trim(cel.Value) = sku Then
' Oude commentaar weg
If Not cel.Comment Is Nothing Then cel.Comment.Delete
' Nieuwe commentaar
Set note = cel.AddComment
note.Text ""
With note.Shape
.Fill.UserPicture fotoPad
.Height = 200
.Width = shp.Width / shp.Height * 200
.Line.Visible = msoFalse
End With
End If
Next cel
Next ws
shp.Delete
MsgBox "Foto gekoppeld aan alle cellen met SKU " & sku, vbInformation
End Sub
Sub KoppelFotosAanSKU()
Dim ws As Worksheet
Dim cel As Range
Dim fotoPad As String
Dim shp As Shape
Dim note As Comment
Set ws = Worksheets("DATABASE")
For Each cel In ws.UsedRange
If Trim(cel.Value) <> "" Then
fotoPad = ThisWorkbook.Path & "\Afbeeldingen\" & Trim(cel.Value) & ".jpg"
If Dir(fotoPad) <> "" Then
Set shp = ws.Shapes.AddPicture(fotoPad, msoFalse, msoTrue, 0, 0, -1, -1)
shp.LockAspectRatio = msoTrue
shp.Height = 200
If Not cel.Comment Is Nothing Then cel.Comment.Delete
Set note = cel.AddComment
note.Text ""
With note.Shape
.Fill.UserPicture fotoPad
.Height = 200
.Width = shp.Width / shp.Height * 200
.Line.Visible = msoFalse
End With
shp.Delete
End If
End If
Next cel
MsgBox "Foto's gekoppeld waar mogelijk."
End Sub
Sub VerwijderFotoOpmerkingenUitSelectie()
Dim cel As Range
For Each cel In Selection
If Not cel.Comment Is Nothing Then
cel.Comment.Delete
End If
Next cel
End Sub
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.