Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default macro to find a max value in a column select corresponding userfor

I need to create a macro that will find the max value in a column and use
that value to select a userform.
The worksheet with the data is called "Raw Data". In column A, the data
could look like 1,2,3,4,5,6,7,8,9,10,11,12. I want to find the max value
(12) and have the macro select UserForm12. The max value (in this case 12)
will also be used to select the appropriate worksheet for UserForm12 which
will be "Logsheet12".
This will OPEN the appropriate userform and loghseet. The other worksheets
will be hidden from the user. Excuse the redundancy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default macro to find a max value in a column select corresponding userfor

Try something like this. I used the worksheet function max and then used a
case select based on the max value.


Sub maxvalue()

Lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set maxrange = Range(Cells(1, "A"), Cells(Lastrow, "A"))

maximumvalue = WorksheetFunction.Max(maxrange)

Select Case maximumvalue

Case 12
Worksheets("Logsheet12").Activate

End Select

End Sub


"cj2k2k" wrote:

I need to create a macro that will find the max value in a column and use
that value to select a userform.
The worksheet with the data is called "Raw Data". In column A, the data
could look like 1,2,3,4,5,6,7,8,9,10,11,12. I want to find the max value
(12) and have the macro select UserForm12. The max value (in this case 12)
will also be used to select the appropriate worksheet for UserForm12 which
will be "Logsheet12".
This will OPEN the appropriate userform and loghseet. The other worksheets
will be hidden from the user. Excuse the redundancy

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
Find Select Macro mkerstei[_17_] Excel Programming 0 August 3rd 06 10:56 PM
Lopp in column to find and select al007 Excel Programming 3 December 29th 05 07:47 AM
Call Userfor and click button with macro ExcelMonkey[_190_] Excel Programming 2 February 25th 05 04:41 PM
Find Last Column, Select, and Bold Yellowbird Excel Programming 5 June 24th 04 04:59 PM
How to find a value then select that column Sevcav Excel Programming 1 November 5th 03 02:18 AM


All times are GMT +1. The time now is 03:22 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"