oam
05-14-2018, 05:16 PM
I am using the VBA FIND feature in Excel 2010 (see code below) to locate and select employee numbers from a report generated by another system. After the employee number is selected, need to select down to the next empty cell within the column and everything in between. The information for each employee is different each day, each employee could have 2 lines of information or 15 lines so the code would select the employee number and select down to the first empty cell after the employee number.
Hope this makes sense and thank you any and all help
GCell.Select
If GCell Is Nothing Or GCell = "" Then GoTo Line1
IsEmpty Range(GCell.End(xlDown).offset(1, 0), GCell.offset(0, 20)).Select
lr = lastrow(DestSh)
Selection.Copy Destination:=Sheets("ProductionTotals").Range("C" & lr + 3)
Line1:
GCell1.Select
If GCell1 Is Nothing Or GCell1 = "" Then GoTo Line2
IsEmpty Range(GCell1.End(xlDown).offset(1, 0), GCell1.offset(0, 20)).Select
lr = lastrow(DestSh)
Selection.Copy Destination:=Sheets("ProductionTotals ").Range("C" & lr + 3)
Line2:
GCell2.Select
If GCell2 Is Nothing Or GCell2 = "" Then GoTo Line3
IsEmpty Range(GCell2.End(xlDown).offset(1, 0), GCell2.offset(0, 20)).Select
lr = lastrow(DestSh)
Selection.Copy Destination:=Sheets("ProductionTotals ").Range("C" & lr + 3)
Hope this makes sense and thank you any and all help
GCell.Select
If GCell Is Nothing Or GCell = "" Then GoTo Line1
IsEmpty Range(GCell.End(xlDown).offset(1, 0), GCell.offset(0, 20)).Select
lr = lastrow(DestSh)
Selection.Copy Destination:=Sheets("ProductionTotals").Range("C" & lr + 3)
Line1:
GCell1.Select
If GCell1 Is Nothing Or GCell1 = "" Then GoTo Line2
IsEmpty Range(GCell1.End(xlDown).offset(1, 0), GCell1.offset(0, 20)).Select
lr = lastrow(DestSh)
Selection.Copy Destination:=Sheets("ProductionTotals ").Range("C" & lr + 3)
Line2:
GCell2.Select
If GCell2 Is Nothing Or GCell2 = "" Then GoTo Line3
IsEmpty Range(GCell2.End(xlDown).offset(1, 0), GCell2.offset(0, 20)).Select
lr = lastrow(DestSh)
Selection.Copy Destination:=Sheets("ProductionTotals ").Range("C" & lr + 3)