MsgBox Rows(iRow).Top
iRow = Sheets("sheet1").HPageBreaks(1).Location.Row
Sub AAAAD()
Dim img As Object
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False
.ButtonName = "Submit"
.Title = "Select an image file"
.Filters.Clear
.Filters.Add "JPG", "*.JPG"
.Filters.Add "JPEG File Interchange Format", "*.JPEG"
.Filters.Add "Graphics Interchange Format", "*.GIF"
.Filters.Add "Portable Network Graphics", "*.PNG"
.Filters.Add "Tag Image File Format", "*.TIFF"
.Filters.Add "All Pictures", "*.*"
If .Show = -1 Then
Set img = ActiveSheet.Pictures.Insert(.SelectedItems(1))
End If
End With
With img
.Left = 0
If img.Height > Rows(Sheets("Sheet2").HPageBreaks(1).Location.Row).Top - Sheets("Sheet2").Shapes("TextBox 1").Top + Sheets("Sheet2").Shapes("TextBox 1").Height Then
.Top = Rows(Sheets("Sheet2").HPageBreaks(1).Location.Row).Top
Else
.Top = Sheets("Sheet2").Shapes("TextBox 1").Top + Sheets("Sheet2").Shapes("TextBox 1").Height
End If
End With
End Sub
Needs cleaning up but you should be able to do that I assume.
Change references, like Sheet Names etc, if and where required
Code:Sub AAAAD() Dim img As Object With Application.FileDialog(msoFileDialogFilePicker) .AllowMultiSelect = False .ButtonName = "Submit" .Title = "Select an image file" .Filters.Clear .Filters.Add "JPG", "*.JPG" .Filters.Add "JPEG File Interchange Format", "*.JPEG" .Filters.Add "Graphics Interchange Format", "*.GIF" .Filters.Add "Portable Network Graphics", "*.PNG" .Filters.Add "Tag Image File Format", "*.TIFF" .Filters.Add "All Pictures", "*.*" If .Show = -1 Then Set img = ActiveSheet.Pictures.Insert(.SelectedItems(1)) End If End With With img .Left = 0 If img.Height > Rows(Sheets("Sheet2").HPageBreaks(1).Location.Row).Top - Sheets("Sheet2").Shapes("TextBox 1").Top + Sheets("Sheet2").Shapes("TextBox 1").Height Then .Top = Rows(Sheets("Sheet2").HPageBreaks(1).Location.Row).Top Else .Top = Sheets("Sheet2").Shapes("TextBox 1").Top + Sheets("Sheet2").Shapes("TextBox 1").Height End If End With End Sub
If img.Height > Rows(Worksheets("sheet2").HPageBreaks(1).Location.Row).Top - Sheets("sheet2").Shapes("TextBox4").Top + Sheets("sheet2").Shapes("TextBox4").Height Then