Hello The_Vulcan,
You can place all your code into a Standard VBA Module to create a shared Macro. The trick is identifying the UserForm that called the Macro. This really is pretty simple. UserForms like Windows are part of a collection. With Windows, the active Window is always the first Window of the collection. The same is true with UserForms.
#### gather ####
With UserForms(0)
.Controls("Customer").Value = Range("B" & thisrow & "")
.Controls("PONumber").Value = Range("C" & thisrow & "")
.Controls("Division").Value = Range("D" & thisrow & "")
If Len(ActiveCell.Value) > 0 Then
arr = Split(ActiveCell.Value, ",")
For I = LBound(arr) To UBound(arr)
For j = 0 To WorkshopResources.ListCount - 1
If WorkshopResources.List(j) = arr(I)Then
WorkshopResources.Selected(j) = True
Next j
Next I
End If
End With
#### submit ####
With UserForms(0)
Range("B" & thisrow & "") = .Controls("Customer").Value
Range("C" & thisrow & "") = .Controls("PONumber").Value
Range("D" & thisrow & "") = .Controls("Division").Value
If Not (holder = "") Then
ActiveCell.Value = Left(holder, Len(holder) - 1)
End If
End With
Sincerely,
Leith Ross
Bookmarks