Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I scan a large table/worksheet for values?

I'm having trouble figuring out how to scan an entire spreadsheet for a
value. I then need to return the corresponding values from row name and
column header, but one step at a time€¦lol.

I have a table with several rows and columns sorted ascending. Each column
can contain a value of interest. The value of interest is an arbitrary
constant (Say 12). Im looking to find the €œbest€ value of €œ12€ in the table
that with a maximum corresponding row OR column value. Exp: Say I have a
table that is 10 rows by 10 columns. In the first Row are my column headers:
A, B, C, D, E, F, G, H, I, J. In my First Column are my row names: 50, 55,
60, 65, 70, 75, 80, 85, 90, 95. In the body of the table are values that can
range from 10 to 15. I want to find the Value €œ12€ from the body of the
table that has the highest corresponding row name value. Simple, no? lol.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default How do I scan a large table/worksheet for values?

Try something like thss:

Dim maxrow As Long, maxcol As Integer
With Worksheets(1).Range("a1:j11")
maxrow = 0
maxcol = 0
srchval = 12
Set c = .Find(srchval, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
If c.Row maxrow Then maxrow = c.Row
If c.Column maxcol Then maxcol = c.Column
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address < firstAddress
End If
End With
MsgBox "row = " & maxrow & " column = " & maxcol


HTH

"Omeganutz" wrote:

I'm having trouble figuring out how to scan an entire spreadsheet for a
value. I then need to return the corresponding values from row name and
column header, but one step at a time€¦lol.

I have a table with several rows and columns sorted ascending. Each column
can contain a value of interest. The value of interest is an arbitrary
constant (Say 12). Im looking to find the €œbest€ value of €œ12€ in the table
that with a maximum corresponding row OR column value. Exp: Say I have a
table that is 10 rows by 10 columns. In the first Row are my column headers:
A, B, C, D, E, F, G, H, I, J. In my First Column are my row names: 50, 55,
60, 65, 70, 75, 80, 85, 90, 95. In the body of the table are values that can
range from 10 to 15. I want to find the Value €œ12€ from the body of the
table that has the highest corresponding row name value. Simple, no? lol.

Reply
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
Inserting a table within a large worksheet TonyH[_2_] Excel Discussion (Misc queries) 2 September 7th 09 08:16 PM
How do I scan in a worksheet so that I can edit or add data? beacon Excel Worksheet Functions 2 February 29th 08 11:26 PM
Scan range of rows and export to 2nd worksheet Adam Excel Programming 1 March 14th 05 06:03 AM
Please help me to solve auto-scan of worksheet gilbert Excel Programming 2 January 13th 04 06:07 AM
scan for repeating values and then delete peach255 C Excel Programming 1 July 9th 03 10:40 PM


All times are GMT +1. The time now is 01:15 AM.

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

About Us

"It's about Microsoft Excel"