Disliked{quote} I cannot guarantee a clear help dear Tom but explain me via PM what you have and what you want to do and let me examine for a while. My schedule is really busy but I will give a try with no serious promises.Ignored
Disliked.... Sub OpenCSV() Dim sourceWb As Workbook Dim targetWb As Workbook Dim sourceWs As Worksheet Dim targetWs As Worksheet Dim sourceRng....Ignored
1) Load parameters set from menu screen.
So I set starting Low/High Price/Date. - I find these numbers on my MT4 chart - currently wanna analyze EU movement since 13.3. low 1,04617 and measure strength of waves. So I set starting low + high into menu and first part of program loads it.
2) Search dates in timeserie if they match selected low and high.
If match - simply write it few columns to the right and set StartingRow for peakfinder search.
For some reason, this part of program, no matter how simple it is, aint working. Code is exactly the same. I have tested bot If and Case commands, but neither of these recognizes 13.3.2015 as low date (LoDate), although it has no problem seeing 26.3.2015 as HiDate.
Please, if you see what am doing wrong, help would be very much appreciated. Ofc will share whole code once is ready.
Btw, if someone knows how can I insert that window into posts so codes are cleaner please tell me.
T
Sub HiLoPF()
Dim Wb As Workbook
Dim MenuWs, DataWs, PFWs As Worksheet
Dim PFStart, b, rng, rng2 As Range
Dim LoPrice, HiPrice, z, w As Double
Dim LoDate, HiDate As Date
Dim Store, LastRow, FirstRow, WaveID, i, n As Integer
'1) Set parameters
Set Wb = ActiveWorkbook
Set MenuWs = Wb.Worksheets("Menu")
Set DataWs = Wb.Worksheets("Data")
LastRow = DataWs.Range("A1").CurrentRegion.Rows.Count
LoDate = MenuWs.Cells(9, 3)
HiDate = MenuWs.Cells(10, 3)
LoPrice = MenuWs.Cells(9, 4)
HiPrice = MenuWs.Cells(10, 4)
'2) Clear Peakfinder + Hi/Lo target range
DataWs.Activate
Range(Cells(2, 8), Cells(LastRow, 8)).ClearContents
'4) Set starting search range
Set rng = DataWs.Range(Cells(2, 1), Cells(LastRow, 1))
For Each b In rng
Select Case b
Case Is = LoDate
b.Offset(0, 7) = LoPrice
Case Is = HiDate
b.Offset(0, 7) = HiPrice
FirstRow = b.Row + 1
Set rng = Range(b.Offset(FirstRow, 4), b.Offset(LastRow, 4))
Exit For
End Select
Next
End Sub
"I know one thing, that I know nothing." Sokrates