I've tried to take the macro that was provided and add in some additional formatting steps, but I can't get it to work as required. What I would like it to do:
1) Capture 2 pieces of information via an input box
2) Insert 4 rows at the top of each worksheet
3) Insert text in cells A1 and A2 that is aligned to the left of the cell
4) Insert an image in cell G1
5) Change the page set up to make each worksheet fit to 1 page wide and 1 tall
Here is the code as it stands:
Code:
Sub Statements()
'Insert initial summary worksheet
Worksheets.Add().Name = "Summary"
'Get client name
Response = InputBox("Please enter client name", "Input Box")
'Get date
Response2 = InputBox("Please enter date in the following format dd/mm/yy", "Input Box")
'Format individual worksheets
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws
'
'
.Rows("1:4").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
.Range("A1").FormulaR1C1 = Response & " Call Account Statement as at " & Response2
Range("A1").Select
With Selection
.HorizontalAlignment = xlLeft
End With
.Range("A2").FormulaR1C1 = "Text in here"
Range("A2").Select
With Selection
.HorizontalAlignment = xlLeft
End With
Range("G1").Select
ActiveSheet.Pictures.Insert("c:\Logo.PNG").Select
Set Emplacement = Range("G1")
Set objImg = ActiveSheet.DrawingObjects(ActiveSheet.Shapes.Count)
With objImg.ShapeRange
.LockAspectRatio = msoFalse
.Left = Emplacement.Left
.Top = Emplacement.Top
End With
With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
End With
Next ws
Sheets("Summary").Select
Range("A5").Select
End Sub
The problems I am facing are:
1)The image is being inserted in to the first sheet only, and pasted multiple times on top of itself
2) The left justifiation of the text only happens on the first worksheet
3) The page set up of 1 wide by 1 tall is only being applied to the first worksheet
It would be much appreciated if someone could point me in the right direction. I appreciate that the code I have added isn't very elegant, I'm very much a VBA beginner.