Mattandy55
New Member
- Joined
- May 27, 2016
- Messages
- 20
Hi there,
I am a little stuck with an enhancement to something that already exists. I have the below existing code that when a cell in that range is triggered it runs the code depending on which column. However, I need to add 2 buttons, that would loop through the whole column and run offer macro, print, and then run the next offer macro for the next record, and so on. Basically, the goal would be to run the existing macro offer, print that page, and then do it again for as many records as necessary without individually clicking each one. Also, it would be great that this loop worked for only records present if there was a filter applied to the data. Any help you can provide would be greatly appreciated. Please let me know if there are any items I can help further elaborate on.
I am a little stuck with an enhancement to something that already exists. I have the below existing code that when a cell in that range is triggered it runs the code depending on which column. However, I need to add 2 buttons, that would loop through the whole column and run offer macro, print, and then run the next offer macro for the next record, and so on. Basically, the goal would be to run the existing macro offer, print that page, and then do it again for as many records as necessary without individually clicking each one. Also, it would be great that this loop worked for only records present if there was a filter applied to the data. Any help you can provide would be greatly appreciated. Please let me know if there are any items I can help further elaborate on.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Count = 1 Then
If Not Intersect(Target, Range("B2:B2000")) Is Nothing Then
Call offer
End If
End If
If Selection.Count = 1 Then
If Not Intersect(Target, Range("C2:C2000")) Is Nothing Then
Call comp
End If
End If
End Sub
Sub offer()
Sheets("SelectData").Range("C1").Value = ActiveCell.Address
Sheets("Offer Statement").Visible = True
Sheets("Comp Statement").Visible = False
Sheets("Employees").Visible = False
Sheets("Job Title List").Visible = False
Sheets("Offer Statement").Select
End Sub
Sub comp()
Sheets("SelectData").Range("C1").Value = ActiveCell.Address
Sheets("Offer Statement").Visible = False
Sheets("Comp Statement").Visible = True
Sheets("Employees").Visible = False
Sheets("Job Title List").Visible = False
Sheets("Comp Statement").Select
End Sub
Sub ReturntoEmployees()
Sheets("Employees").Visible = True
Sheets("Comp Statement").Visible = False
Sheets("Offer Statement").Visible = False
Sheets("Employees").Select
End Sub
Last edited by a moderator: