ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Query (https://www.excelbanter.com/excel-programming/357786-macro-query.html)

Greg B[_8_]

Macro Query
 
Hi all,
I am wondering how to do this, I need to have a macro look up the max value
in column a on sheet2 and then give the total plus 1 in textbox1
I tried this but I cant get
Private Sub UserForm_Activate()

TextBox1.Value = Max(ActiveSheet.Range("a1:a50000") + 1)


End Sub

thanks

Greg



Bob Phillips[_6_]

Macro Query
 
Private Sub UserForm_Activate()
TextBox1.Value = Application.Max(ActiveSheet.Range("a1:a50000") + 1)
End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Greg B" wrote in message
...
Hi all,
I am wondering how to do this, I need to have a macro look up the max

value
in column a on sheet2 and then give the total plus 1 in textbox1
I tried this but I cant get
Private Sub UserForm_Activate()

TextBox1.Value = Max(ActiveSheet.Range("a1:a50000") + 1)


End Sub

thanks

Greg





Toppers

Macro Query
 
TextBox1.Value = Application.Max(ActiveSheet.Range("a1:a50000") )+ 1

"Greg B" wrote:

Hi all,
I am wondering how to do this, I need to have a macro look up the max value
in column a on sheet2 and then give the total plus 1 in textbox1
I tried this but I cant get
Private Sub UserForm_Activate()

TextBox1.Value = Max(ActiveSheet.Range("a1:a50000") + 1)


End Sub

thanks

Greg




Greg B[_8_]

Macro Query
 
Thanks for that Bob

Greg
"Bob Phillips" wrote in message
...
Private Sub UserForm_Activate()
TextBox1.Value = Application.Max(ActiveSheet.Range("a1:a50000") + 1)
End Sub


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Greg B" wrote in message
...
Hi all,
I am wondering how to do this, I need to have a macro look up the max

value
in column a on sheet2 and then give the total plus 1 in textbox1
I tried this but I cant get
Private Sub UserForm_Activate()

TextBox1.Value = Max(ActiveSheet.Range("a1:a50000") + 1)


End Sub

thanks

Greg








All times are GMT +1. The time now is 04:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com