Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / April 2007

Tip: Looking for answers? Try searching our database.

Troubleshoot

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gautam - 19 Apr 2007 16:01 GMT
I am find an error in this statement, and the error shown is
"Application defined error or object defined error"

ActiveSheet.Range(Chr(r + 64 + 0) & c).Formula = "=index(" & Chr(11 +
64) & "2:" & Chr(11 + 64) & (max_date) & ",match(" & Chr(1 + 64) & r &
",L2:L" & max_row & "))"

The above statement basically used to match the data from one column
with any column, corresponding to the indexed column. used for
matching dates and times

Could any one please solve this
Dave Peterson - 19 Apr 2007 17:04 GMT
First, you can use other ways to address cells other than .range().  In your
case, .cells() looks like it work much nicer.

.cells(x,y).formula

The x represents the row and the y represents the column.  And y can be a number
or a letter--excel will accept either.

I _think_ that this may be closer to what you want:

Option Explicit
Sub testme()

   Dim iRow As Long
   Dim iCol As Long
   Dim Max_Row As Long
   
   'test data
   iRow = 3
   iCol = 3
   Max_Row = 777
   
   ActiveSheet.Cells(iRow, iCol).Formula _
      = "=index(K2:K" & Max_Row & ",match(A" & iRow & ",l2:L" & Max_Row & "))"
   
End Sub

Notice that I changed (max_date) to max_row.  I can't think of where I'd want
the range in =index() to have different number of rows than the range in the
=match() portion.

> I am find an error in this statement, and the error shown is
> "Application defined error or object defined error"
[quoted text clipped - 8 lines]
>
> Could any one please solve this

Signature

Dave Peterson

Gautam - 23 Apr 2007 06:32 GMT
> First, you can use other ways to address cells other than .range().  In your
> case, .cells() looks like it work much nicer.
[quoted text clipped - 43 lines]
>
> Dave Peterson

Thanks Dave

Macro's working

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.