Ron,
Put your list into column A of one sheet. On another sheet, starting in Cell A1 and going across
Row 1, put the identifiers for the data that you want to extract/remove from your datatable:
ID # :
Sex :
Raw Scores :
T Scores :
These whould be entered into A1, B1, C1, D1. Note the inclusion of the colon.
Then select those cells (you can have as many as you want, as long as the strings appear within your
database) and name them "Headers" (Select them, then use Insert / Names... Define...)
Then select your sheet with the database of values, and run the macro below.
If you cannot get it to work, I will send you a working example.
HTH,
Bernie
MS Excel MVP
Sub MakeDataBase()
Dim myData As Range
Dim myArea As Range
Dim myCell As Range
Dim i As Integer
Dim myRow As Long
myRow = 2
Set myData = ActiveSheet.Range("A:A"). _
SpecialCells(xlCellTypeConstants, 2)
For Each myArea In myData.Areas
For Each myCell In myArea
For i = 1 To Range("Headers").Cells.Count
If InStr(1, myCell.Value, Range("Headers"). _
Cells(1, i).Value) > 0 Then
Range("Headers").Parent.Cells(myRow, i).Value = _
Application.Trim(Replace(myCell.Value, _
Range("Headers").Cells(1, i).Value, ""))
End If
Next i
Next myCell
myRow = myRow + 1
Next myArea
With Range("Headers").Parent
.Range("D:I").EntireColumn.Insert
.Range("C2", .Cells(Rows.Count, 3).End(xlUp)).TextToColumns _
Destination:=.Range("C2"), _
DataType:=xlDelimited, _
ConsecutiveDelimiter:=True, _
Space:=True
.Range("C1:I1").Formula = "=""Raw Score "" & Column()-2"
.Range("C1:I1").Value = .Range("C1:I1").Value
.Range("J2", .Cells(Rows.Count, 10).End(xlUp)).TextToColumns _
Destination:=.Range("J2"), _
DataType:=xlDelimited, _
ConsecutiveDelimiter:=True, _
Space:=True
.Range("J1:P1").Formula = "=""T Score "" & Column()-9"
.Range("J1:P1").Value = .Range("J1:P1").Value
End With
End Sub
> Bernie:
>
[quoted text clipped - 86 lines]
>> >
>> > Thank you for your help!!
dsjrcw@gmail.com - 14 Sep 2006 23:14 GMT
Thanks guys for your help!! I tried both ways and I was only able to
get Bernie's to work. But I didn't spend too much time once I had a
working version. I think there are differences in the spacing in my
original file and what I pasted into the newsgroup. I will keep trying
for curiosity sake in my free time adjusting the Find setting.
I appreciate all the time you've invested to solve my problem!!
> Ron,
>
[quoted text clipped - 156 lines]
> >> >
> >> > Thank you for your help!!
Pete_UK - 15 Sep 2006 01:42 GMT
Thanks for feeding back. I wondered about the extra spaces myself.
Obviously, if Bernie's method works for you then use that.
Pete
> Thanks guys for your help!! I tried both ways and I was only able to
> get Bernie's to work. But I didn't spend too much time once I had a
[quoted text clipped - 164 lines]
> > >> >
> > >> > Thank you for your help!!