Hello all,
I know this is something but I was wondering if anyone could help me simplify the following macro. I'm still new to writing macros and the following code adds a new job entry into a job list. I used recording and other steps to write it and it work, but it feels a little long and I know it can be shortened but I don't know where to start, so if you can please help me that would be great.
Thank you if you can help.
I know this is something but I was wondering if anyone could help me simplify the following macro. I'm still new to writing macros and the following code adds a new job entry into a job list. I used recording and other steps to write it and it work, but it feels a little long and I know it can be shortened but I don't know where to start, so if you can please help me that would be great.
Code:
Sub New_Job()
Dim Job, PM, ProjectName, Contractor As String
Application.ScreenUpdating = False
Job = InputBox("Input Job #")
PM = InputBox("Input PM initials")
ProjectName = InputBox("Input Project Name")
Contractor = InputBox("Input Contractor's Name")
Sheets("Current Job List").Range("A7:A10").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromBelow
Sheets("Current Job List").Range("B7:B10").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromBelow
Sheets("Current Job List").Range("C7:C10").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromBelow
Sheets("Current Job List").Range("D7:D10").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromBelow
Sheets("Current Job List").Range("E7:E10").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromBelow
Sheets("Current Job List").Range("F7:F10").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromBelow
Sheets("Current Job List").Range("D7:D10").Select
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Sheets("Current Job List").Range("C7:C10").Select
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Sheets("Current Job List").Range("B7:B10").Select
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Sheets("Current Job List").Range("A7:A10").Select
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Sheets("Current Job List").Range("A7").Value = Job
Range("A7:A10").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 90
End With
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 12
End With
Sheets("Current Job List").Range("B7").Value = PM
Range("B7:B10").Select
Selection.Merge
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
End With
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 9
End With
Sheets("Current Job List").Range("C7").Value = ProjectName
Sheets("Current Job List").Range("D7").Value = Contractor
Sheets("Current Job List").Range("E7").Value = "Office contact:"
Sheets("Current Job List").Range("E8").Value = "Jobsite contact:"
Sheets("Current Job List").Range("E9").Value = "Jobsite phone:"
Sheets("Current Job List").Range("E10").Value = "Jobsite fax:"
With Sheets("Current Job List").Range("E4:E7").Font
.Name = "Arial"
.Size = 8
.Bold = False
End With
Application.ScreenUpdating = True
End Sub
Thank you if you can help.