Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default can I search all worksheets in an xls for highest number on load?

Hi,

I have a massive list spread over many worksheets in a single XLS file.

There is a field, always in column B, that contains an alpha numeric
number.

What I could really do with is a macro (I guess) that when you load the
file, looks though all records in the B column of all worksheets and
can report to another field somewhere what the greatest number
currently existing in all column B's is.

Is this possible, and if so, could someone offer advice on how please?

thanks

PS, if this IS do-able and is a fairly easy thing, can it also check
again if a new row is added onto a worksheet?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default can I search all worksheets in an xls for highest number on load?

Sub Auto_Open()
MaxColB

End Sub

Sub MaxColB()
Dim n As Long
Dim mx As Double
Dim ws As Worksheet

ReDim va(1 To Worksheets.Count)

For Each ws In ThisWorkbook.Worksheets
n = n + 1
va(n) = Application.Max(ws.Range("B:B"))
Next

mx = Application.Max(va)

MsgBox mx

Worksheets("Sheet1").Range("A1") = mx

End Sub

Regards,
Peter T

PS Your question about is a new row added is not clear


wrote in message
oups.com...
Hi,

I have a massive list spread over many worksheets in a single XLS file.

There is a field, always in column B, that contains an alpha numeric
number.

What I could really do with is a macro (I guess) that when you load the
file, looks though all records in the B column of all worksheets and
can report to another field somewhere what the greatest number
currently existing in all column B's is.

Is this possible, and if so, could someone offer advice on how please?

thanks

PS, if this IS do-able and is a fairly easy thing, can it also check
again if a new row is added onto a worksheet?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default can I search all worksheets in an xls for highest number on load?

Hi,

thanks for the reply.

I tried to implement this, but when I load the XLS, I get the option to
run the macro but nothing seems to happen.

Maybe I need idiots guide to adding this macro properly to excel?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default can I search all worksheets in an xls for highest number on load?

The two routines, Auto_Open and MaxColB both go in a normal module.

First test MaxColB and ensure it works. You will probably want to change
Worksheets("Sheet1").Range("A1")
to suit.

The Auto_Open routine should run automatically when the file opens and call
MaxColB, assuming your security settings allow macros.

Save the file with macros and reopen, the Msgbox should pop up confirming
all is working. Once it is, comment or remove the Msgbox line.

Regards,
Peter T


"megoodsen" wrote in message
ups.com...
Hi,

thanks for the reply.

I tried to implement this, but when I load the XLS, I get the option to
run the macro but nothing seems to happen.

Maybe I need idiots guide to adding this macro properly to excel?



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
Search row of numbers, find highest value. Ice Bear Excel Worksheet Functions 2 June 4th 09 03:55 PM
Add a number '1' next to highest number in column Mally Excel Discussion (Misc queries) 4 April 27th 09 10:03 AM
Search multiple worksheets and return value based on phone number Jane Doe[_3_] Excel Worksheet Functions 1 September 11th 08 06:46 AM
2 rows, highest No in row 1, then highest number in row 2 relating to that column, possible duplicates John Excel Worksheet Functions 3 August 11th 06 04:34 AM
load several ASCII files in different worksheets bandy2000 Excel Programming 7 March 15th 05 01:13 PM


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

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"