|
Allan (Admin) besvarede i Juli 2010 et spørgsmål omkring indsæt af billede: https://forum.excel-regneark.dk/indstte-billeder-automatisk_topic53. - https://forum.excel-regneark.dk/indstte-billeder-automatisk_topic53.htmlMit problem går så ud på, at jeg ikke kan finde ud at at fortælle makroen at billedet skal i cellen til venstre for det indtastede. Er der nogle der har et gyldent input? Makroen ser således ud: Public Const DefExtention = ".jpg" Public Const DefLocation = "I:\VVS Foto\" Public Const IndtastningsKolonneBogstav = "A" Public Const IndtastningsKolonnenr = 1 Public Const IndtastningsStartRaekke = 2 Public Const IndtastningsSlutRaekke = 20 Sub Batch() For Each c In Ark1.Range(IndtastningsKolonneBogstav & IndtastningsStartRaekke & ":" & IndtastningsKolonneBogstav & IndtastningsSlutRaekke).Cells InsertPictureInRange DefLocation & c.Value & DefExtention, c.Offset(100, 1) Next c End Sub Sub InsertPictureInRange(PictureFileName As String, TargetCells As Range) Dim p As Object, t As Double, l As Double, w As Double, h As Double If TypeName(ActiveSheet) <> "Worksheet" Then Exit Sub If Dir(PictureFileName) = "" Then Exit Sub Set p = ActiveSheet.Pictures.Insert(PictureFileName) With TargetCells t = .Top l = .Left w = .Offset(0, .Columns.Count).Left - .Left h = .Offset(.Rows.Count, 0).Top - .Top End With With p .Top = t .Left = l .Width = w .Height = h End With Set p = Nothing End Sub Leif
|