Pushing an image to the following page if it is over the page break

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,352
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have a procedure that pastes in a signature from another sheet, just below the bottom of a quote. Is there a way to push it to the next page if the signature ends up being half on one page and half on the next?

VBA Code:
Function LastRow()

    With Sheets("CSS_quote_sheet")
        LastRow = .Range("A:H").Find(What:="*", _
            After:=.Range("A1"), _
            Lookat:=xlPart, _
            LookIn:=xlFormulas, _
            SearchOrder:=xlByRows, _
            SearchDirection:=xlPrevious, _
            MatchCase:=False).Row
    End With
End Function
Sub cmdSig()
    Sheets("Sheet2").Shapes("ImgT").Copy
    ActiveSheet.Paste Destination:=ActiveSheet.Cells(1, 1)
    Selection.Top = Cells(LastRow, 1).Top + "100"
End Sub
 
I found a working version of my workbook, where the signature is appearing below the text. That means the only issue left to solve is pushing the image to the next page if it gets split across pages. What information do you require to help me with that?

With your questions, the last row is not the text "Please type your notes below..." as that is a label. The last row is the "Total incl GST"
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
The first row in the table is the header row in row 10 with the data starting in row 11. The first row on page 2 is row 37, 70 for page 3, 103 for page 4 and so on.
 
Upvote 0
"Selection.Top = Cells(LastRow, 1).Top + "100""
What is the 100?
 
Upvote 0
In Post #21 you twice mention "notes written". Now you say it is a label.
Anyway, you need to know the bottom of the last item, can be row, can be another picture or whatever, where you want your signature image to go below.
You should be able to find that with lastrow for just data, BottomRightCell for a shape.
The number from that + the height of your signature shape should be less than the first horizontal page break.
If not, your signature image should go to the 2nd page. (below the horizontal page break.
 
Upvote 0
The label is on the sheet to tell the user to write notes below this point. Notes can be added by the user, which will go below the label. They may be added or may not.
 
Upvote 0
I added this code to my push procedure just to see what BottomRightCell returned but

Excel Formula:
DividerBottom = Sheets("CSS_quote_sheet").Shapes("Divider").BottomRightCell
remained 0 all through the procedure. Maybe there is something wrong with my syntax.
 
Upvote 0
What is the result of this?
Code:
DividerBottom = Sheets("CSS_quote_sheet").Shapes("Divider").BottomRightCell.Row
 
Upvote 0
I get 32, which is the row that has the divider in it. I tried moving the divider and the number changed to the new row number that had the divider.
 
Upvote 0
My supervisor has just told me that he is happy with how it is working at the moment. Thank you for your help in trying to help me solve this problem.
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,520
Members
448,968
Latest member
Ajax40

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top