LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 265
Default a With missing and I don´t know where and how to put it

I, I have this macro that look for a value between 2 numbers in column x and
the interpolate for a given value, the macro is:

Sub inter()
Dim Value
Dim a, P As Integer
Dim XRange As Range
Dim YRange As Range

Value = 5.5 'value given by the user (could be textbox1)
a = 1
Set XRange = Range("a1:a600")
Set YRange = Range("b1:b600")
While a < XRange.Rows.Count
If Value Cells(a, 1) And Value < Cells(a + 1, 1) Then
P = a
Xs = Array(.Index(XRange.Value2, P, 1), .Index(XRange.Value2, P + 1,
1))
Ys = Array(.Index(YRange.Value2, P, 1), .Index(YRange.Value2, P
+ 1, 1))
Interpolate = .Forecast(Value, Ys, Xs)
MsgBox Interpolate
Else
a = a + 1
End If
Wend
End Sub

I know that those .Index and .Forecast needs a "with" and "end with"
but I don't know what kind of with (I thought With activeworksheet but it
didn't work)
so could someone tell me how to make my macro run????
TIA
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
hiding all cells that dont have any text Misho Excel Discussion (Misc queries) 5 September 27th 09 01:59 PM
Kinda like a database - I cant believe others dont need to do th Bob Excel Discussion (Misc queries) 3 December 12th 08 03:02 PM
I don´t view the value right after six decimal place in Excel Claudio Excel Discussion (Misc queries) 4 August 6th 08 12:58 PM
Dont want member number to repeat in the same column. TPkk Excel Discussion (Misc queries) 1 October 29th 06 09:21 PM
Don´t show Updatelinks prompt and don´t update Kent Excel Programming 4 August 26th 04 05:50 PM


All times are GMT +1. The time now is 03:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"