wait while I try that.
It worked for me.
maybe the error is before that. Does your version of excel have the TextJoin function?
This version gives you the Textjoin Function.
Sub Test()
'Here I am creating an array containing the start and end cells of your selection.
'
'You only need to select one cell
If Selection.Cells.Count = 1 Or Selection.Cells.Count > 10000 Then
SAddress = Split(Selection.Address & Selection.Address, "$")
Else
SAddress = Split(Replace(Selection.Address, ":", ""), "$")
End If
'Here I am extending your selection Up to find the first empty row
'I an using textjoin to check that columns A to L are empty
'
SRow:
Set LLine = Range("A" & SAddress(2) - 1 & ":L" & SAddress(2) - 1)
If SAddress(2) > 2 And TEXTJOIN2("", True, LLine) <> "" Then SAddress(2) = SAddress(2) - 1: GoTo SRow
'Here I am extending your selection Down to find the first empty row
'I an using textjoin to check that columns A to L are empty
'
ERow:
Set LLine = Range("A" & SAddress(4) & ":L" & SAddress(4))
If TEXTJOIN2("", True, LLine) <> "" Then SAddress(4) = SAddress(4) + 1: GoTo ERow
'Here I am cutting the selected range
Range("A" & SAddress(2) & ":L" & SAddress(4)).Select
Selection.Cut
'Here I am insertig the cut cells
Sheets("Queue").Select
Range("A2").Select
Selection.Insert Shift:=xlDown
'Here I am deleting the original selection
Sheets("Recipes").Select
Selection.EntireRow.Delete
End Sub
Function TEXTJOIN2(Delimiter As String, IgnoreBlanks As Boolean, ParamArray Text() As Variant) As String
Dim Item As Variant, V As Variant, Arr As Variant
For Each Item In Text
If VarType(Item) > 8191 Then
For Each V In Item
If Len(V) > 0 Or (Len(V) = 0 And Not IgnoreBlanks) Then TEXTJOIN2 = TEXTJOIN2 & Delimiter & V
Next
Else
TEXTJOI2N = TEXTJOIN2 & Delimiter & Item
End If
Next
TEXTJOIN2 = Mid(TEXTJOIN2, Len(Delimiter) + 1)
End Function
Bookmarks