erutherford
Active Member
- Joined
- Dec 19, 2016
- Messages
- 449
The code takes entry information ("entries") and prefills another worksheet ("Final_Wash") with that data. Works flawless.
I would like to modify the code so that it looks at the "entries" worksheet, column I and only selects those records with a "W".
Usually pretty good at modifying existing code, but stumped on this one. My guess is the modification is in the "create array from range"
I would like to modify the code so that it looks at the "entries" worksheet, column I and only selects those records with a "W".
Usually pretty good at modifying existing code, but stumped on this one. My guess is the modification is in the "create array from range"
Code:
<code>
Private Sub CommandButton8_Click() 'Wash Print Final
Dim EntriesRange As Range, BasicRange As Range
Dim PrintCell As Range, cell As Range
Dim Data As Variant
Dim i As Integer
Dim msg
msg = MsgBox("Confirm Print all records?", vbYesNo, "Confirm")
If msg = vbYes Then
With ThisWorkbook
'basic sheet data entry range
Set BasicRange = .Worksheets("Final_Wash").Range("B2,D2,E2,B5,C5,D5,E5,G5,J5")
With .Worksheets("Entries")
Set EntriesRange = .Range(.Range("A3"), .Range("A" & .Rows.Count).End(xlUp))
End With
End With
For Each cell In EntriesRange.Cells
'create array from range
Data = Application.Transpose(cell.Resize(1, 9).Value2)
i = 1
'array elements to non-contiguous range
For Each PrintCell In BasicRange.Cells
PrintCell.Value = Data(i, 1)
'increment to next array element
i = i + 1
Next PrintCell
'print out record
BasicRange.Parent.PrintPreview
Next cell
ElseIf msg = vbNo Then
End If
Exit Sub
End Sub
</code>
Last edited by a moderator: