Hi all, and thanks in advance for any help that may be offered.
The code attached allows me to select a column of data and then to copy that data into some other place in an excel spreadsheet. It will also take every alternate cell and copy it into the adjoining column parallel to the cell immediately above. Ime not sure if I had to explain all that for my q, but anyway, this is what i am trying to do.
The column of data that I select I need that it first be sorted into the reverse order, i.e the last cell of the selected data to become the first and so on. From then on, my macro should continue to run as it currently does.
Thank You so much for any help in advance.
The code attached allows me to select a column of data and then to copy that data into some other place in an excel spreadsheet. It will also take every alternate cell and copy it into the adjoining column parallel to the cell immediately above. Ime not sure if I had to explain all that for my q, but anyway, this is what i am trying to do.
The column of data that I select I need that it first be sorted into the reverse order, i.e the last cell of the selected data to become the first and so on. From then on, my macro should continue to run as it currently does.
Thank You so much for any help in advance.
VBA Code:
Sub MoveRange()
Dim rng As Range
Dim InputRng As Range, OutRng As Range
On Error GoTo ErrorMessage
Dim xTitleId As String
Dim i As Long
xTitleId = "Hello"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
Set OutRng = Application.InputBox("Out put to (single cell):", xTitleId, Type:=8)
Set InputRng = InputRng.Columns(1)
For i = 1 To InputRng.Rows.Count Step 2
OutRng.Resize(1, 2).Value = Array(InputRng.Cells(i, 1).Value, InputRng.Cells(i + 1, 1).Value)
Set OutRng = OutRng.Offset(1, 0)
Next
ErrorMessage:
Exit Sub
End Sub