Is this what you mean/
Private Sub CommandButton1_Click()
Dim rngIn As Range
Dim rngOut As Range
Dim rngCl As Range
Dim Col As Long
Dim Rw As Long
Dim LastRw As Long
Dim answr As VbMsgBoxResult
With Sheet19
Col = Application.InputBox("Enter final column of data to copy", Type:=1)
If Col < 3 Or Col > 5 Then Exit Sub 'change max & min column here
LastRw = .Cells(.Rows.Count, 2).End(xlUp).Row
Set rngIn = .Range(.Cells(3, 2), .Cells(LastRw, Col)) '.SpecialCells(xlCellTypeVisible)
End With
With Sheet24
.Cells.Clear
Rw = 1
For Each rngCl In rngIn
If Not IsEmpty(rngCl) Then
.Cells(Rw, 1).Value = rngCl.Value
Rw = Rw + 1
End If
Next rngCl
Application.CutCopyMode = False
With .UsedRange
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End With
'Call OtherBlaBla
Application.Goto Sheet24.Cells(1, 1)
End Sub
Bookmarks