Hey everyone, I have created a macro to copy information from one workbook and paste in another. I'm putting in If statements and the only problem is that I cannot figure out how to get the macro to go to the next empty row if the condition is met for both of the if statements. Please help me out.
Private Sub Transfer_Click()
Dim SubmissionID As String
Dim BatchName As String
Dim DateReviewed As Date
Dim RetrievalAssociate As String
Dim DoesVolumeMatch As String
Dim WasCorrectMediaAttached As String
Dim WasPDFNamedCorrectly As String
Dim myData As Workbook
Worksheets("sheet1").Select
SubmissionID = Range("a4")
Worksheets("sheet1").Select
BatchName = Range("b4")
Worksheets("sheet1").Select
DateReviewed = Range("d4")
Worksheets("sheet1").Select
RetrievalAssociate = Range("e4")
Worksheets("sheet1").Select
DoesVolumeMatch = Range("H4")
Worksheets("sheet1").Select
WasCorrectMediaAttached = Range("I4")
Worksheets("sheet1").Select
WasPDFNamedCorrectly = Range("J4")
Set myData = Workbooks.Open("H:\0 MediaValidationFormTest.xlsm")
Worksheets("Account_Details").Select
Worksheets("Account_Details").Range("a4").Select
RowCount = Worksheets("Account_Details").Range("a4").CurrentRegion.Rows.Count
With Worksheets("Account_Details").Range("a4")
.Offset(ColumnCount + 3, 2) = SubmissionID
.Offset(ColumnCount + 2, 2) = BatchName
.Offset(ColumnCount + 0, 2) = DateReviewed
.Offset(ColumnCount + 1, 2) = RetrievalAssociate
If WasCorrectMediaAttached = "No" Then
.Offset(ColumnCount + 9, 1) = "Was the correct media attached?"
Else
If DoesVolumeMatch = "No" Then
.Offset(ColumnCount + 9, 1) = "Does Volume match spreadsheet total?"
Else
Exit Sub 'do nothing
End If
End If
End With
myData.Save
End Sub
Private Sub Transfer_Click()
Dim SubmissionID As String
Dim BatchName As String
Dim DateReviewed As Date
Dim RetrievalAssociate As String
Dim DoesVolumeMatch As String
Dim WasCorrectMediaAttached As String
Dim WasPDFNamedCorrectly As String
Dim myData As Workbook
Worksheets("sheet1").Select
SubmissionID = Range("a4")
Worksheets("sheet1").Select
BatchName = Range("b4")
Worksheets("sheet1").Select
DateReviewed = Range("d4")
Worksheets("sheet1").Select
RetrievalAssociate = Range("e4")
Worksheets("sheet1").Select
DoesVolumeMatch = Range("H4")
Worksheets("sheet1").Select
WasCorrectMediaAttached = Range("I4")
Worksheets("sheet1").Select
WasPDFNamedCorrectly = Range("J4")
Set myData = Workbooks.Open("H:\0 MediaValidationFormTest.xlsm")
Worksheets("Account_Details").Select
Worksheets("Account_Details").Range("a4").Select
RowCount = Worksheets("Account_Details").Range("a4").CurrentRegion.Rows.Count
With Worksheets("Account_Details").Range("a4")
.Offset(ColumnCount + 3, 2) = SubmissionID
.Offset(ColumnCount + 2, 2) = BatchName
.Offset(ColumnCount + 0, 2) = DateReviewed
.Offset(ColumnCount + 1, 2) = RetrievalAssociate
If WasCorrectMediaAttached = "No" Then
.Offset(ColumnCount + 9, 1) = "Was the correct media attached?"
Else
If DoesVolumeMatch = "No" Then
.Offset(ColumnCount + 9, 1) = "Does Volume match spreadsheet total?"
Else
Exit Sub 'do nothing
End If
End If
End With
myData.Save
End Sub