A
acctemp
Being a very novice programmer I didn't know how to combine the
functions of all these command buttons (examples of two are below, they
are all identical except for the value they are looking for and the
range they copy to). I have about 55 command buttons which are all
executed by one button, very inefficient. Thanks for help in advance!
Private Sub CommandButton54_Click()
Dim r As Range
Set r = Cells.Find(What:="102", After:=Range("A129"),
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=True)
If Range("A129") = "" Then
r.Offset(1).Resize(1, 4).Copy Range("B6")
Else
r.Offset(1).Resize(1, 4).Copy Range("A" &
Rows.Count).End(xlUp).Offset(1)
End If
End Sub
Private Sub CommandButton55_Click()
Dim r As Range
Set r = Cells.Find(What:="103", After:=Range("A129"),
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=True)
If Range("A129") = "" Then
r.Offset(1).Resize(1, 4).Copy Range("B7")
Else
r.Offset(1).Resize(1, 4).Copy Range("A" &
Rows.Count).End(xlUp).Offset(1)
End If
End Sub
functions of all these command buttons (examples of two are below, they
are all identical except for the value they are looking for and the
range they copy to). I have about 55 command buttons which are all
executed by one button, very inefficient. Thanks for help in advance!
Private Sub CommandButton54_Click()
Dim r As Range
Set r = Cells.Find(What:="102", After:=Range("A129"),
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=True)
If Range("A129") = "" Then
r.Offset(1).Resize(1, 4).Copy Range("B6")
Else
r.Offset(1).Resize(1, 4).Copy Range("A" &
Rows.Count).End(xlUp).Offset(1)
End If
End Sub
Private Sub CommandButton55_Click()
Dim r As Range
Set r = Cells.Find(What:="103", After:=Range("A129"),
LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=True)
If Range("A129") = "" Then
r.Offset(1).Resize(1, 4).Copy Range("B7")
Else
r.Offset(1).Resize(1, 4).Copy Range("A" &
Rows.Count).End(xlUp).Offset(1)
End If
End Sub