I did this and it tested fine. Format your sheet 3.
I can send the workbook,if desired.
Sub GetDataSAS()
Application.ScreenUpdating = False
Set cs = Sheets("sheet1")
Set ds = Sheets("sheet3")
getdate:
ans = InputBox("Enter a proper date: ex: 7/1/2009 " & vbCr & " or touch the
enter key for ALL")
On Error GoTo doall
Set mycol = cs.Rows(1).Find(what:=CDate(ans), LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
_
MatchCase:=False)
If mycol Is Nothing Then GoTo getdate
doall:
If ans = "" Then
mc = 0
Else
mc = mycol.Column
End If
'MsgBox mc
If mc = 0 Then
dlr = ds.Cells(Rows.Count, 1).End(xlUp).Row
ds.Rows(2).Resize(dlr).Delete
x = 3: y = cs.Cells(1, Columns.Count).End(xlToLeft).Column
Else
x = mc: y = mc
End If
For Each ws In Array("sheet1", "sheet2")
Set ss = Sheets(ws)
For j = 2 To ss.Cells(Rows.Count, 1).End(xlUp).Row
For i = x To y
dlr = ds.Cells(Rows.Count, 1).End(xlUp).Row + 1
If ss.Cells(j, i) > 0 Then
ds.Cells(dlr, 1).Value = ss.Cells(j, 1).Value
ds.Cells(dlr, 2).Value = ss.Cells(j, 2).Value
ds.Cells(dlr, 3).Value = ss.Cells(1, i).Value
ds.Cells(dlr, 4).Value = ss.Cells(j, i).Value
End If
Next i
Next j
Next ws
dlr = ds.Cells(Rows.Count, 1).End(xlUp).Row
ds.Range("A1

" & dlr).Sort _
Key1:=ds.Range("C2"), Order1:=xlAscending, _
Key2:=ds.Range("B2"), Order2:=xlAscending, _
Key3:=ds.Range("A2"), Order3:=xlAscending, _
Header:=xlGuess, OrderCustom:=1, MatchCase:=False, _
Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal, DataOption3:=xlSortNormal
Application.ScreenUpdating = True
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(E-Mail Removed)
"joel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Don: All the code that I posted had the dots. for some reason some of
> the replies are missing the dots. I can't see what I did wrong that the
> code is reading and writing to sheet2 without the select.
>
> Ivan: check you code and make sure the al the Methods below start with
> a period:
>
> Range
> Columns
> Cells
>
>
> Ivan if you are not getting the code from the CodeCage try this URL
>
> http://www.thecodecage.com/forumz/ne...reply&p=597160
>
>
> --
> joel
> ------------------------------------------------------------------------
> joel's Profile: 229
> View this thread:
> http://www.thecodecage.com/forumz/sh...d.php?t=165248
>
> Microsoft Office Help
>