![]() |
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 |
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 |
All times are GMT +1. The time now is 09:06 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com