ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,738
- Office Version
- 2007
- Platform
- Windows
Hi,
I am using the following code of which works well,
The worksheet is called G INCOME & i would like to run the above code but also take note of the following,
Month in cell G3
Value in cell J31
Value in cell K31
With the above info we now need to go to another worksheet so,
The path is C:\Users\Ian\Desktop\GRASS CUTTING\CURRENT GRASS SHEETS\SUMMARY SHEET\SHEET
Months column range C5:C17
Income column range D5:D17
Mileage column range E5:E17
So then as follows,
WORKSHEET G INCOME cell G3 to WORKSHEET SHEET look in the range of C5:C17 for a match then
WORKSHEET G INCOME cell J31 to WORKSHEET SHEET cell in the range of D5:D17
WORKSHEET G INCOME cell K31 to WORKSHEET SHEET cell in the range of E5:E17
The code would need to somehow pick out the matching month in range C5:C17 then paste the two values into its corresponding row cell
Here is a photo to give you some visual info.
As you will see there are 2 months of APRIL
I am using the following code of which works well,
Code:
Private Sub GrassSummaryIncomeSheet_Click() Dim strFileName As String
strFileName = "C:\Users\Ian\Desktop\GRASS CUTTING\CURRENT GRASS SHEETS\INCOME 2019-2020\" & _
Range("J3") & "_" & Format(Month(DateValue(Range("G3") & " 1, " & "2019")), "00") & " " & Range("G3") & ".pdf"
If Dir(strFileName) <> vbNullString Then
MsgBox "INCOME GRASS SHEET " & Range("G3") & " " & Range("J3") & " WAS NOT SAVED AS IT ALREADY EXISTS", vbCritical + vbOKOnly, "INCOME SUMMARY GRASS SHEET MESSAGE"
Exit Sub
End If
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True
MsgBox "INCOME GRASS SHEET " & Range("G3") & " " & Range("J3") & " WAS SAVED SUCCESSFULLY", vbInformation + vbOKOnly, "INCOME SUMMARY GRASS SHEET MESSAGE"
Range("G5:H30").ClearContents
Range("G5").Select
ActiveWorkbook.Save
End With
End Sub
The worksheet is called G INCOME & i would like to run the above code but also take note of the following,
Month in cell G3
Value in cell J31
Value in cell K31
With the above info we now need to go to another worksheet so,
The path is C:\Users\Ian\Desktop\GRASS CUTTING\CURRENT GRASS SHEETS\SUMMARY SHEET\SHEET
Months column range C5:C17
Income column range D5:D17
Mileage column range E5:E17
So then as follows,
WORKSHEET G INCOME cell G3 to WORKSHEET SHEET look in the range of C5:C17 for a match then
WORKSHEET G INCOME cell J31 to WORKSHEET SHEET cell in the range of D5:D17
WORKSHEET G INCOME cell K31 to WORKSHEET SHEET cell in the range of E5:E17
The code would need to somehow pick out the matching month in range C5:C17 then paste the two values into its corresponding row cell
Here is a photo to give you some visual info.
As you will see there are 2 months of APRIL
Last edited: