ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Stupid End(xlup) problem (https://www.excelbanter.com/excel-programming/307784-stupid-end-xlup-problem.html)

Steph[_3_]

Stupid End(xlup) problem
 
Hello. I am trying to determine the max # in a column. I have the
following code:

Range("B30").Formula = Application.WorksheetFunction.Max(Range("B4:B" &
Rows.Count).End(xlUp).Row)

But when i debug this, it says Max(Range("B4:B" & Rows.Count).End(xlUp).Row)
= 2. So it looks like it is highlighting b4:b65536, then hitting end(xlup),
which brings the activecell to B2. I just want it to use B4:the last used
cell.

I am assuming I have a paren in the worng place or something simple. Please
help? Thanks!



Don Guillett[_4_]

Stupid End(xlup) problem
 
& cells(Rows.Count,"b")).End(xlUp).Row)

--
Don Guillett
SalesAid Software

"Steph" wrote in message
...
Hello. I am trying to determine the max # in a column. I have the
following code:

Range("B30").Formula = Application.WorksheetFunction.Max(Range("B4:B" &
Rows.Count).End(xlUp).Row)

But when i debug this, it says Max(Range("B4:B" &

Rows.Count).End(xlUp).Row)
= 2. So it looks like it is highlighting b4:b65536, then hitting

end(xlup),
which brings the activecell to B2. I just want it to use B4:the last used
cell.

I am assuming I have a paren in the worng place or something simple.

Please
help? Thanks!





Chip Pearson

Stupid End(xlup) problem
 
Steph,

Try

Range("B30").Formula = _
Application.WorksheetFunction.Max(Range("B4:B" & _
Cells(Rows.Count, "B").End(xlUp).Row))



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Steph" wrote in message
...
Hello. I am trying to determine the max # in a column. I have

the
following code:

Range("B30").Formula =

Application.WorksheetFunction.Max(Range("B4:B" &
Rows.Count).End(xlUp).Row)

But when i debug this, it says Max(Range("B4:B" &

Rows.Count).End(xlUp).Row)
= 2. So it looks like it is highlighting b4:b65536, then

hitting end(xlup),
which brings the activecell to B2. I just want it to use

B4:the last used
cell.

I am assuming I have a paren in the worng place or something

simple. Please
help? Thanks!





Steph[_3_]

Stupid End(xlup) problem
 
Thanks guys!!!

"Chip Pearson" wrote in message
...
Steph,

Try

Range("B30").Formula = _
Application.WorksheetFunction.Max(Range("B4:B" & _
Cells(Rows.Count, "B").End(xlUp).Row))



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Steph" wrote in message
...
Hello. I am trying to determine the max # in a column. I have

the
following code:

Range("B30").Formula =

Application.WorksheetFunction.Max(Range("B4:B" &
Rows.Count).End(xlUp).Row)

But when i debug this, it says Max(Range("B4:B" &

Rows.Count).End(xlUp).Row)
= 2. So it looks like it is highlighting b4:b65536, then

hitting end(xlup),
which brings the activecell to B2. I just want it to use

B4:the last used
cell.

I am assuming I have a paren in the worng place or something

simple. Please
help? Thanks!







Don Guillett[_4_]

Stupid End(xlup) problem
 
I am glad to help and glad to agree with Chip.

--
Don Guillett
SalesAid Software

"Steph" wrote in message
...
Thanks guys!!!

"Chip Pearson" wrote in message
...
Steph,

Try

Range("B30").Formula = _
Application.WorksheetFunction.Max(Range("B4:B" & _
Cells(Rows.Count, "B").End(xlUp).Row))



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Steph" wrote in message
...
Hello. I am trying to determine the max # in a column. I have

the
following code:

Range("B30").Formula =

Application.WorksheetFunction.Max(Range("B4:B" &
Rows.Count).End(xlUp).Row)

But when i debug this, it says Max(Range("B4:B" &

Rows.Count).End(xlUp).Row)
= 2. So it looks like it is highlighting b4:b65536, then

hitting end(xlup),
which brings the activecell to B2. I just want it to use

B4:the last used
cell.

I am assuming I have a paren in the worng place or something

simple. Please
help? Thanks!










All times are GMT +1. The time now is 12:42 PM.

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