Hi guys,
I appreciate the help with this guys... I'm such a noob. So i borrowed the following script for selecting every other row from a free tutorial site somewhere on the web...
Sub EveryOtherRow()
Dim rng As Range
Dim InputRng As Range
Dim OutRng As Range
Dim xInterval As Integer
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
xInterval = Application.InputBox("Enter row interval", xTitleId, Type:=1)
For i = 1 To InputRng.Rows.Count Step xInterval + 1
Set rng = InputRng.Cells(i, 1)
If OutRng Is Nothing Then
Set OutRng = rng
Else
Set OutRng = Application.Union(OutRng, rng)
End If
Next
OutRng.EntireRow.Select
Which I used while recording a macro designed to extract behavioural data from psychophysiological experiments. While recording and running the above script, two dialogue boxes appeared to nominate the parameters of the selections. First the range (which i had previously selected and so was automatically recorded in this dialogue box) and then the row interval for selections (in this case: 1 as I wish to highlight every other row). The resulting selected rows were copied and then pasted into a new sheet in order to have the selected data be formatted without cells in between each data point. The reason for doing this way, is for formatting in a third sheet and for preservation of the raw data formatting.
However, when I run the finished macro the above script is missing. So my question is, how can I insert this into my macro in VBA with the parameters that meet the range selection 'A2:A400' and with a selection interval of one (i.e. select A2, A4, A6 etc.), have these selections copied and pasted to a new sheet?
Thanks again to anyone who can help, the macro took me a fair while to record and editing useless code took almost as long. I appreciate it guys.
Cheers,
Matt.
Bookmarks